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