Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3349)

Unified Diff: base/process/memory_win.cc

Issue 2130293003: Change OOMs to raise custom exception rather than breakpoint on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove unused func Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/process/memory_win.cc
diff --git a/base/process/memory_win.cc b/base/process/memory_win.cc
index 17d588aab739be0d9e9419f1bb757e7c01e3dfa6..864527798261eef3398a61ced6c98ab9a7b4d399 100644
--- a/base/process/memory_win.cc
+++ b/base/process/memory_win.cc
@@ -7,8 +7,7 @@
#include <new.h>
#include <psapi.h>
#include <stddef.h>
-
-#include "base/logging.h"
+#include <windows.h>
// malloc_unchecked is required to implement UncheckedMalloc properly.
// It's provided by allocator_shim_win.cc but since that's not always present,
@@ -35,10 +34,12 @@ namespace {
int OnNoMemory(size_t size) {
// Kill the process. This is important for security since most of code
// does not check the result of memory allocation.
- LOG(FATAL) << "Out of memory, size = " << size;
+ // https://msdn.microsoft.com/en-us/library/het71c37.aspx
+ ::RaiseException(win::kOomExceptionCode, EXCEPTION_NONCONTINUABLE, 0,
+ nullptr);
// Safety check, make sure process exits here.
- _exit(1);
+ _exit(win::kOomExceptionCode);
return 0;
}

Powered by Google App Engine
This is Rietveld 408576698