Index: base/process_util_mac.mm |
diff --git a/base/process_util_mac.mm b/base/process_util_mac.mm |
index b257021401726975aa33eb3fc7cc96b140964141..e20f8bf5528eb37ffe2c0cfada8cab0f2435a630 100644 |
--- a/base/process_util_mac.mm |
+++ b/base/process_util_mac.mm |
@@ -836,16 +836,10 @@ id oom_killer_allocWithZone(id self, SEL _cmd, NSZone* zone) |
} // namespace |
-malloc_zone_t* GetPurgeableZone() { |
- // malloc_default_purgeable_zone only exists on >= 10.6. Use dlsym to grab it |
- // at runtime because it may not be present in the SDK used for compilation. |
- typedef malloc_zone_t* (*malloc_default_purgeable_zone_t)(void); |
- malloc_default_purgeable_zone_t malloc_purgeable_zone = |
- reinterpret_cast<malloc_default_purgeable_zone_t>( |
- dlsym(RTLD_DEFAULT, "malloc_default_purgeable_zone")); |
- if (malloc_purgeable_zone) |
- return malloc_purgeable_zone(); |
- return NULL; |
Avi (use Gerrit)
2012/09/13 19:45:54
Thanks for removing this.
Scott Hess - ex-Googler
2012/09/13 20:04:00
Oops, added about this to the CL description.
|
+void* oom_safe_malloc(size_t size) { |
+ if (g_old_malloc) |
+ return g_old_malloc(malloc_default_zone(), size); |
+ return malloc(size); |
} |
void EnableTerminationOnOutOfMemory() { |
@@ -880,7 +874,7 @@ void EnableTerminationOnOutOfMemory() { |
ChromeMallocZone* default_zone = |
reinterpret_cast<ChromeMallocZone*>(malloc_default_zone()); |
ChromeMallocZone* purgeable_zone = |
- reinterpret_cast<ChromeMallocZone*>(GetPurgeableZone()); |
+ reinterpret_cast<ChromeMallocZone*>(malloc_default_purgeable_zone()); |
vm_address_t page_start_default = 0; |
vm_address_t page_start_purgeable = 0; |