This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [Patch] Convert pool_allocator
- From: Dhruv Matani <dhruvbird at gmx dot net>
- To: Paolo Carlini <pcarlini at suse dot de>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>, Benjamin Kosnik <bkoz at redhat dot com>
- Date: 22 Mar 2004 15:02:52 +0530
- Subject: Re: [Patch] Convert pool_allocator
- Organization:
- References: <405DCFE4.5070809@suse.de>
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
intention.
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))
__throw_bad_alloc();
Which may be safely removed.
--
-Dhruv Matani.
http://www.geocities.com/dhruvbird/
Proud to be a Vegetarian.
http://www.vegetarianstarterkit.com/
http://www.vegkids.com/vegkids/index.html