Improve best-effort logging before termination on OOM
Suggested by @kallewoof in bitcoin/bitcoin#9856
This commit is contained in:
parent
d207b81d28
commit
3c9dbf3ed8
|
@ -730,6 +730,7 @@ bool AppInitServers(boost::thread_group& threadGroup)
|
|||
// Since LogPrintf may itself allocate memory, set the handler directly
|
||||
// to terminate first.
|
||||
std::set_new_handler(std::terminate);
|
||||
fputs("Error: Out of memory. Terminating.\n", stderr);
|
||||
LogPrintf("Error: Out of memory. Terminating.\n");
|
||||
|
||||
// The log was successful, terminate now.
|
||||
|
|
Loading…
Reference in New Issue