This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Question about allocator design
- To: libstdc++ at gcc dot gnu dot org
- Subject: Question about allocator design
- From: "Richard B. Kreckel" <kreckel at ginac dot de>
- Date: Mon, 16 Apr 2001 15:15:52 +0200 (CEST)
- Reply-To: Richard dot Kreckel at Uni-Mainz dot DE
Hello,
After a week-long attempt to hunt down memleaks in a library that makes
heavy use of STL containers I found out that they were not really memleaks
but a "feature" of the old libstdc++ from GCC-2.95.x, namely the old
allocator did not free all memory to be reused by subsequent allocations.
I have found an old document at <http://www.sgi.com/tech/stl/alloc.html>
that describes this as a feature because it may make programs run faster
and not introduce a delay on program exit because the OS reclaims memory
on program exit anyways without touching it.
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! I have tried to search the
GCC web page about a rational for dropping or leaving the old behaviour
but to no avail. My question is: Is this analysis correct or are there
exceptions to the rule?
And maybe somebody can update me with the obvious confusion: Is this
mandated by the standard? Was it a threat to thread-safety? Maybe is
there any document on the web describing the change and why it was made?
Regards
-richy.
--
Richard Kreckel
<Richard.Kreckel@GiNaC.DE>
<http://wwwthep.physik.uni-mainz.de/~kreckel/>