__USE_MALLOC sanity check
Benjamin Kosnik
bkoz@redhat.com
Thu Jun 27 11:57:00 GMT 2002
> // 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
More information about the Libstdc++
mailing list