activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olivier Langlois <>
Subject library function exception specification omitting std::bad_alloc
Date Tue, 17 Nov 2009 15:49:01 GMT

My server has been terminated when a std::bad_alloc has been thrown from the ActiveMQCPP library
and because this exception is not listed anywhere where the exception specification is used
by the library methods declaration.

I am questioning whether or not omitting std::bad_alloc from the exception specification is
the good thing to do.

We all agree that if this exception is happening it is an indication that there is a memory
leak somewhere. However, by letting this exception pass, that would allow the library user
to terminate nicely. In my context, that means closing all my network connections to clients
of my service and updating the access log files. This information is crucial and everytime
the server aborts the business loses money. That would also be inacceptable in a life critical

For these reasons, I would suggest you to consider adding std::bad_alloc in all the library
exception specifications.

Olivier Langlois
C++ Technical Lead


t. 1 866 448 4037 ext. 675
t. 1 514 448 4037 ext. 675
f. 1 514 807 1861
StreamTheWorld launches its new BlackBerry application. Learn more

View raw message