| Index: base/allocator/allocator_interception_mac.mm
|
| diff --git a/base/allocator/allocator_interception_mac.mm b/base/allocator/allocator_interception_mac.mm
|
| index c484830da5e2538904cd1b8218ca8fb97e354536..fc811501cbba8f1dcde4b11dda7e3432d144afaf 100644
|
| --- a/base/allocator/allocator_interception_mac.mm
|
| +++ b/base/allocator/allocator_interception_mac.mm
|
| @@ -352,9 +352,21 @@ void StoreFunctionsForAllZones() {
|
| ChromeMallocZone* zone = reinterpret_cast<ChromeMallocZone*>(zones[i]);
|
| StoreMallocZone(zone);
|
| }
|
| +
|
| + // This ensures that the purgeable zone is at the back of the array.
|
| + ChromeMallocZone* purgeable_zone =
|
| + reinterpret_cast<ChromeMallocZone*>(malloc_default_purgeable_zone());
|
| + StoreMallocZone(purgeable_zone);
|
| }
|
|
|
| void ReplaceFunctionsForStoredZones(const MallocZoneFunctions* functions) {
|
| + ChromeMallocZone* default_zone =
|
| + reinterpret_cast<ChromeMallocZone*>(malloc_default_zone());
|
| + if (IsMallocZoneAlreadyStored(default_zone) &&
|
| + default_zone->malloc != functions->malloc) {
|
| + ReplaceZoneFunctions(default_zone, functions);
|
| + }
|
| +
|
| vm_address_t* zones;
|
| unsigned int count;
|
| kern_return_t kr =
|
| @@ -367,6 +379,14 @@ void ReplaceFunctionsForStoredZones(const MallocZoneFunctions* functions) {
|
| ReplaceZoneFunctions(zone, functions);
|
| }
|
| }
|
| +
|
| + ChromeMallocZone* purgeable_zone =
|
| + reinterpret_cast<ChromeMallocZone*>(malloc_default_purgeable_zone());
|
| + if (IsMallocZoneAlreadyStored(purgeable_zone) &&
|
| + purgeable_zone->malloc != functions->malloc) {
|
| + ReplaceZoneFunctions(purgeable_zone, functions);
|
| + }
|
| +
|
| g_replaced_default_zone = true;
|
| }
|
|
|
|
|