This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: _set_new_handler vs. set_new_handler


> 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


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