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

Unified Diff: base/allocator/allocator_interception_mac.mm

Issue 2676093003: mac: Hook up allocator shim during app startup. (Closed)
Patch Set: Remove unused include. Created 3 years, 10 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/allocator/allocator_interception_mac.h ('k') | base/process/memory_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/allocator/allocator_interception_mac.mm
diff --git a/base/allocator/allocator_interception_mac.mm b/base/allocator/allocator_interception_mac.mm
index be6c0fa4e9e7261012d2af6525d31fbee9986343..e945a293beb58fbe36e9e4f2c17f1525293b28cc 100644
--- a/base/allocator/allocator_interception_mac.mm
+++ b/base/allocator/allocator_interception_mac.mm
@@ -27,6 +27,8 @@
#include <new>
+#include "base/allocator/allocator_shim.h"
+#include "base/allocator/features.h"
#include "base/logging.h"
#include "base/mac/mac_util.h"
#include "base/mac/mach_logging.h"
@@ -38,12 +40,13 @@
namespace base {
namespace allocator {
+bool g_replaced_default_zone = false;
+
MallocZoneFunctions::MallocZoneFunctions() {}
namespace {
bool g_oom_killer_enabled;
-bool g_replaced_default_zone = false;
// Starting with Mac OS X 10.7, the zone allocators set up by the system are
// read-only, to prevent them from being overwritten in an attack. However,
@@ -203,12 +206,6 @@ void* oom_killer_memalign_purgeable(struct _malloc_zone_t* zone,
#endif // !defined(ADDRESS_SANITIZER)
-// === C++ operator new ===
-
-void oom_killer_new() {
- TerminateBecauseOutOfMemory(0);
-}
-
#if !defined(ADDRESS_SANITIZER)
// === Core Foundation CFAllocators ===
@@ -441,13 +438,6 @@ void InterceptAllocationsMac() {
// system's malloc implementation. It's unlikely that anyone's even heard of
// it.
- // === C++ operator new ===
-
- // Yes, operator new does call through to malloc, but this will catch failures
- // that our imperfect handling of malloc cannot.
-
- std::set_new_handler(oom_killer_new);
-
#ifndef ADDRESS_SANITIZER
// === Core Foundation CFAllocators ===
« no previous file with comments | « base/allocator/allocator_interception_mac.h ('k') | base/process/memory_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698