This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: stl_alloc.h: malloc_alloc out of memory handling abort()s instead


> Please correct me if I am wrong, I'm trying to remember back quite a way.
> I believe this is because the exception mechanism needs to allocate memory
> in order to throw an exception the way gcc handles exceptions. Since it
> is already out of memory, trying to allocate more memory probably isn't
> a good idea.
> 
> I seem to remember some mail in the past regarding this situation.

What you remember might have been a slightly different situation:
Whether ::operator new would properly throw an exception or not. There
was indeed the problem whether it could throw, and I believe with gcc
2.95, it can.

Section 20.4.1 clearly states that the default allocator must throw
bad_alloc. The #if 0 around BAD_ALLOC appears in the originial sources
of SGI STL 3.11, most likely because not all compilers have a
conforming <new>. In STL 3.2, this is a configurable option.

Regards,
Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]