Issue Details (XML | Word | Printable)

Key: STDCXX-209
Type: Improvement Improvement
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Martin Sebor
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
C++ Standard Library

make std::bad_alloc::what() more informative

Created: 29/Jun/06 12:38 AM   Updated: 02/Jun/08 06:52 PM
Return to search
Component/s: 18. Language Support
Affects Version/s: 4.1.2, 4.1.3, 4.1.4, 4.2.0, 4.2.1
Fix Version/s: 4.3.0

Time Tracking:
Original Estimate: 4h
Original Estimate - 4h
Remaining Estimate: 4h
Remaining Estimate - 4h
Time Spent: Not Specified
Remaining Estimate - 4h

Environment: all

Severity: Usability


 Description  « Hide
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 **** 
#web
Keith,

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 vendors.

Deferred.


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Martin Sebor added a comment - 26/Aug/07 09:11 PM
Added 4.1.4 to affected versions and scheduled for 4.3.

Martin Sebor made changes - 26/Aug/07 09:11 PM
Field Original Value New Value
Affects Version/s 4.1.4 [ 12310693 ]
Fix Version/s 4.3 [ 12312692 ]
Martin Sebor added a comment - 02/Jun/08 06:52 PM
Added 4.2 to the list of affected versions and set initial estimate.

Martin Sebor made changes - 02/Jun/08 06:52 PM
Description 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 ****
#web
Keith,

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 vendors.

Deferred.
Moved from the Rogue Wave bug tracking database:
{noformat}
****Created By: hoaglin @ Sep 17, 2004 07:46:13 PM****

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

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 vendors.

Deferred.
{noformat}
Severity Usability
Affects Version/s 4.2.1 [ 12312690 ]
Affects Version/s 4.2.0 [ 12311945 ]
Remaining Estimate 4h [ 14400 ]
Original Estimate 4h [ 14400 ]