From 3c9dbf3ed8803f3675400abdbabb3aff308086c2 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Mon, 23 Apr 2018 10:39:23 +0100 Subject: [PATCH] Improve best-effort logging before termination on OOM Suggested by @kallewoof in bitcoin/bitcoin#9856 --- src/init.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/init.cpp b/src/init.cpp index 852fd8b50..39013e187 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -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.