This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: _set_new_handler vs. set_new_handler
- From: Marcel Lanz <marcel dot lanz at ds9 dot ch>
- To: Lindner Bernhard <Bernhard dot Lindner at Micronas dot com>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Thu, 25 Aug 2005 17:48:08 +0200
- Subject: Re: _set_new_handler vs. set_new_handler
- References: <AEA1F6D31E97474BB72174D094A8369C0F03BE62@EXCHANGE2.Micronas.com>
> Is it possible to implement such a retry-alloc-mechanism using the GCC
> std lib?
void noMoreMemory()
{
free(panic_heap_memory); panic_heap_memory = 0;
oskit::io::BSPLog::bsp_log("called noMoreMemory", 0);
std::set_new_handler(reallyNoMoreMemory);
}
// for std::set_new_handler
#include <new>
std::set_new_handler(noMoreMemory);
reallyNoMoreMemory is same as noMoreMemory but with more memory.
panic_heap_memory is allocated at startup.
This should work for you I think.
Best Regards
Marcel