Question about allocator design

Phil Edwards pedwards@disaster.jaj.com
Mon Apr 16 08:11:00 GMT 2001


On Mon, Apr 16, 2001 at 03:15:52PM +0200, Richard B. Kreckel wrote:
> So I introduced some malloc_allocs to see if the problems go away and this
> seems indeed to be the case.  Next I tried in on a GCC-3 I bootstrapped a
> few weeks ago and lo and behold, the new libstdc++-v3 does not seem to
> hold a pool of memory for allocators any more!

Not sure whether you mean the trunk or the branch; they are the same in this
respect right now, but this comment has been added to the trunk in c++config:

  // This is the "underlying allocator" for STL.  The alternatives are
  // homegrown schemes involving a kind of mutex and free list; see stl_alloc.h.
  #define __USE_MALLOC

Try commenting this out in c++config and see whether that does what you want.


This behavior is neither mandated nor forbidden by the standard (the standard
in fact doesn't address the issue), but I don't recall offhand why the change
was made.  Your guess about thread-safety is probably correct.  Benjamin?


Phil

-- 
pedwards at disaster dot jaj dot com  |  pme at sources dot redhat dot com
devphil at several other less interesting addresses in various dot domains
The gods do not protect fools.  Fools are protected by more capable fools.



More information about the Libstdc++ mailing list