mt_allocator issues.

Stefan Olsson
Sat Mar 13 15:20:00 GMT 2004

Hi Dhruv,

you are right. The original version was SGI style:
template<int __inst> class __mt_alloc
and since __inst was unused (and set to zero) there was only one 
instance. However this changed when it was turned into a standards 
compliant allocator:
template<typename _Tp> class __mt_alloc

As of right now (late saturday afternoon) I'm not sure if this is a good 
or bad thing, but it was never the less not originally intended this way!

Is it possible (through keywords/compiler options) to get the static 
members "application  wide" instead of one copy per template? Or do we 
have to define them elsewhere to get back to square one?



Dhruv Matani wrote:

>Form the comments at the stat of the file:
> /**
>   *  This is a fixed size (power of 2) allocator which - when
>   *  compiled with thread support - will maintain one freelist per
>   *  size per thread plus a "global" one. Steps are taken to limit
>   *  the per thread freelist sizes (by returning excess back to
>   *  "global").
>But, it seems that currently, it is maintaining a freelist per size per
>thread per type on which it is being instantiated.
>Ok, I may be wrong, but just a hunch.
>Is this what was intended?

More information about the Libstdc++ mailing list