mt_allocator issues.
Dhruv Matani
dhruvbird@gmx.net
Mon Mar 15 12:58:00 GMT 2004
On Mon, 2004-03-15 at 14:23, Stefan Olsson wrote:
> Dhruv Matani wrote:
>
> >On Sat, 2004-03-13 at 20:50, Stefan Olsson wrote:
> >
> >
> >>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?
> >>
> >>
> >
> >I would rather leave that to the maintainers but just to provide an
> >alternative:
> >
> >1. Make __mt_alloc non-templated and make a new template wrapper which
> >derives from the non-templated one.
> >
> >2. Make the static data part of a separate class, and make mt_alloc
> >derive from that.
> >
> >3. Use an unnamed namespace.
> >
> >All 3 seem quite reasonable to me, though, time-wise, 3 would be the
> >best.
> >
> Personally I feel that #1 is the way to go even though this to some
> extent is going back to the old SGI style -> standards style wrapper thingy.
>
> Comments are greatly appriciated! I intend to address this, the "atomic"
> issue and maybe also a change of name within the next couple of days.
Also, if time permits, you could look into the issue of "Overhead per
allocated block".
As I see, currently the overhead for an allocated block for the MT_case
is 8-bytes , which could be reduced to 4-bytes, and for the ST_case is
4-bytes, which can be reduced to 0-bytes.
--
-Dhruv Matani.
http://www.geocities.com/dhruvbird/
Proud to be a Vegetarian.
http://www.vegetarianstarterkit.com/
http://www.vegkids.com/vegkids/index.html
More information about the Libstdc++
mailing list