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

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: comments 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
« no previous file with comments | « base/process/memory_unittest.cc ('k') | chrome/browser/extensions/extension_tab_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/memory_win.cc
diff --git a/base/process/memory_win.cc b/base/process/memory_win.cc
index 406145aff9de578e2605e080ed09fedc11d77a2c..9d75efecacb21af8e9afbb857a1b560fa6c3f171 100644
--- a/base/process/memory_win.cc
+++ b/base/process/memory_win.cc
@@ -7,9 +7,7 @@
#include <new.h>
#include <psapi.h>
#include <stddef.h>
-
-#include "base/logging.h"
-#include "base/strings/safe_sprintf.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,
@@ -34,19 +32,13 @@ namespace {
#pragma warning(disable: 4702)
int OnNoMemory(size_t size) {
- // Make no additional allocations here to avoid getting into a death spiral
- // when trying to log the error message.
- char buf[64];
- strings::ssize_t result =
- strings::SafeSPrintf(buf, "Out of memory, size = %d\n", size);
- RAW_CHECK(result != -1);
-
// Kill the process. This is important for security since most of code
// does not check the result of memory allocation.
- RAW_LOG(FATAL, buf);
-
+ // 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;
}
« no previous file with comments | « base/process/memory_unittest.cc ('k') | chrome/browser/extensions/extension_tab_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698