[Patch] Convert pool_allocator

Dhruv Matani dhruvbird@gmx.net
Mon Mar 22 09:43:00 GMT 2004

On Sun, 2004-03-21 at 22:54, Paolo Carlini wrote:
> Hi all, hi Benjamin,
> eventually I went ahead and converted __pool_alloc according to the
> original plan:
>   http://gcc.gnu.org/ml/libstdc++/2003-12/msg00270.html
> Basically, enabling it at configure time leads to a behavior which is
> (supposed to be) identical to that of 3.3 default allocator.
> Of course, we can consider tweaking it further for MT/not, but I think
> its real virtue is stability in providing a baseline form of "pooling"
> against which more sophisticated ideas will be compared.
> Regtested x86/x86_64/ia64 linux, also checked that on ia64 no runtime
> alignement warnings are issued.
> I will commit to mainline tomorrow morning, if nobody objects.

I have a few things to say:

1. This allocator maintains a per-type pool as opposed to a global only
one pool for all types scheme, which I suspect was the original

2. The check in the allocate function for __n could be removed, because
the standard does not say anything, so we may assume undefined behaviour
if __n is 0.

3. There is a line:
if (__builtin_expect(__ret == 0, 0))

Which may be safely removed.

	-Dhruv Matani.

Proud to be a Vegetarian.

More information about the Libstdc++ mailing list