Also note that IIUC, the only thing that prevents us from solving the
memory-reporting problem using a STL allocator, is that the spec doesn't
allow us to rely on storing per-object member data on a STL allocator.

Even without that, we could at least have a STL allocator doing
per-STL-container-class memory reporting, so that we can at least know how
much memory is taken by all std::set 's together. Just so we know if that
ever becomes a significant portion of dark matter.

Benoit


2013/12/10 Benoit Jacob <jacob.benoi...@gmail.com>

> Note that we already do use at least those STL containers for which we
> don't have an equivalent in the tree. I've seen usage of at least:
> std::map, std::set, and std::bitset.
>
> I think that Nick has a good point about reporting memory usage, but I
> think that the right solution to this problem is to add Mozilla equivalents
> for the STL data structures that we need to "fork", not to skew all your
> design to use the data structures that we have instead of the ones you need.
>
> "Forking" STL data structures into Mozilla code seems reasonable to me.
> Besides memory reporting, it also gives us another benefit: guarantee of
> consistent implementation across platforms and compilers.
>
> Benoit
>
>
>
> 2013/12/10 Nicholas Nethercote <n.netherc...@gmail.com>
>
>> On Tue, Dec 10, 2013 at 8:28 PM, Chris Pearce <cpea...@mozilla.com>
>> wrote:
>> > Hi All,
>> >
>> > Can we start using C++ STL containers like std::set, std::map,
>> std::queue in
>> > Mozilla code please?
>>
>>
>> https://developer.mozilla.org/en-US/docs/Using_CXX_in_Mozilla_code#C.2B.2B_and_Mozilla_standard_libraries
>> has the details.
>>
>> "As a general rule of thumb, prefer the use of MFBT or XPCOM APIs to
>> standard C++ APIs. Some of our APIs include extra methods not found in
>> the standard API (such as those reporting the size of data
>> structures). "
>>
>> I'm particularly attuned to that last point.  Not all structures grow
>> large enough to be worth reporting, but many are.  In the past I've
>> converted STL containers to Mozilla containers just to get memory
>> reporting.
>>
>> Nick
>> _______________________________________________
>> dev-platform mailing list
>> dev-platform@lists.mozilla.org
>> https://lists.mozilla.org/listinfo/dev-platform
>>
>
>
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to