stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Sebor (JIRA)" <>
Subject [jira] Created: (STDCXX-209) make std::bad_alloc::what() more informative
Date Wed, 28 Jun 2006 17:39:29 GMT
make std::bad_alloc::what() more informative

         Key: STDCXX-209
     Project: C++ Standard Library
        Type: Improvement

  Components: 18. Language Support  
    Versions: 4.1.2, 4.1.3    
 Environment: all
    Reporter: Martin Sebor

Moved from the Rogue Wave bug tracking database:

****Created By: hoaglin @ Sep 17, 2004 07:46:13 PM****

**** Entered By: Web @ Thursday, September 09, 2004 8:01:23 AM **** 

I'm not doing garbage collection and I'm not looking for any change in the memory management.
 All I want is that when the new operator throws an exception it sticks the # of bytes of
memory requested in the exception handler what() message. Surely this information is readily
available where the exception is being thrown and I don't see why this should cause any overhead
so long as no exception is being thrown,

****Modified By: sebor @ Apr 11, 2005 02:58:41 PM****
This would be useful but std::bad_alloc is thrown by the operator new defined by the runtime
library that comes with the compiler. We have little control over what string the what() member
function returns. We could wrap calls made by our library in another function, catch the bad_alloc
there, and rethrow another exception derived from std::bad_alloc, where we could override
what() and format the string so as to include the information the user is asking for but that
would only take care of exceptions thrown as a result of running out of memory within the
library itself and not user code. A better solution would be to send this request to compiler


This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message