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

Unified Diff: base/allocator/allocator_interception_mac.mm

Issue 2716183002: mac: Fix StoreFunctionsForAllZones and ReplaceFunctionsForStoredZones. (Closed)
Patch Set: 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 | « no previous file | no next file » | 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 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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698