pool allocator changes and delete[] void*

Paolo Carlini pcarlini@unitus.it
Mon Dec 29 21:14:00 GMT 2003


Gawain Bolton wrote:

> Ok, thanks. One thing that seems incorrect to me is that the
> __pool_alloc<__threads, __inst>::_S_chunk_alloc(size_t __n, int& __nobjs)
> function in pool_allocator.h assumes that a NULL pointer is returned 
> if the
> new fails. This does not strike me as being correct, since the
> std::bad_alloc exception is thrown by operator new(std::size_t) if it 
> fails
> to allocate memory.

That code is quite complex, indeed exceptions *are* taken into account 
(look up
the comments).

Here I just want to point out that the current behavior is the very same 
we had
for 3.3.x (see stl_alloc.h there) and most probably before: only, now we 
don't
go through __new_alloc but instead we call operator new directly.

Paolo.



More information about the Libstdc++ mailing list