This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: __USE_MALLOC sanity check
- From: Benjamin Kosnik <bkoz at redhat dot com>
- To: Phil Edwards <phil at jaj dot com>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Thu, 27 Jun 2002 11:51:32 -0700
- Subject: Re: __USE_MALLOC sanity check
- Organization: Red Hat / San Francisco
- References: <20020626123503.A22666@disaster.basement.lan>
- Reply-to: bkoz at redhat dot com
> // Determines the underlying allocator choice for the node
> allocator.
> #ifdef __USE_MALLOC
> typedef __malloc_alloc_template<0> __mem_interface;
> #else
> typedef __new_alloc __mem_interface;
> #endif
>
> Is "node allocator" meant to refer to std::allocator, or to the memory
> pool__default_alloc_template?
I did this. It's probably a hack. I did it because parts of the standard
tested by commerical regression suites test to make sure that
allocator::allocate calls new.
> Because the comments (largely inherited from SGI) elsewhere all use
> "node allocator" to refer to the pool. But if __USE_MALLOC is in
> effect, then the pool is completely bypassed.
>
> Which raises another question: currently, we either use the pool +
> operator new, or we use malloc. There is never a combination of
> malloc + pool. Maybe that's the way it should be (it certainly strikes
> me as harmless), but I wanted to make certain that this is known and
> intended.
I think that the allocator bits are kind of crufty, and in general the
documentation in source does not appear to be sufficient. Perhaps Matt
could clarify?
-benjamin