Loading...
--- libmalloc/libmalloc-521.120.7/src/purgeable_malloc.c
+++ libmalloc/libmalloc-283/src/purgeable_malloc.c
@@ -80,7 +80,7 @@
entry = large_entry_for_pointer_no_lock(szone, ptr);
SZONE_UNLOCK(szone);
if (entry) {
- return (void)free_large(szone, ptr, false);
+ return free_large(szone, ptr);
} else {
return szone_free(szone->helper_zone, ptr);
}
@@ -214,7 +214,9 @@
szone_t *szone;
kern_return_t err;
- reader = reader_or_in_memory_fallback(reader, task);
+ if (!reader) {
+ reader = _malloc_default_reader;
+ }
err = reader(task, zone_address, sizeof(szone_t), (void **)&szone);
if (err) {
@@ -352,7 +354,7 @@
uint64_t hw_memsize = 0;
/* get memory for the zone. */
- szone = mvm_allocate_pages(SZONE_PAGED_SIZE, 0, DISABLE_ASLR, VM_MEMORY_MALLOC);
+ szone = mvm_allocate_pages(SZONE_PAGED_SIZE, 0, 0, VM_MEMORY_MALLOC);
if (!szone) {
return NULL;
}
@@ -375,17 +377,15 @@
rack_init(&szone->small_rack, RACK_TYPE_SMALL, 0, debug_flags | MALLOC_PURGEABLE);
#if CONFIG_LARGE_CACHE
- if (large_cache_enabled) {
- // madvise(..., MADV_REUSABLE) death-row arrivals above this threshold [~0.1%]
- szone->large_entry_cache_reserve_limit = (size_t)(hw_memsize >> 10);
-
- /* <rdar://problem/6610904> Reset protection when returning a previous large allocation? */
- int32_t libSystemVersion = NSVersionOfLinkTimeLibrary("System");
- if ((-1 != libSystemVersion) && ((libSystemVersion >> 16) < 112) /* CFSystemVersionSnowLeopard */) {
- szone->large_legacy_reset_mprotect = TRUE;
- } else {
- szone->large_legacy_reset_mprotect = FALSE;
- }
+ // madvise(..., MADV_REUSABLE) death-row arrivals above this threshold [~0.1%]
+ szone->large_entry_cache_reserve_limit = (size_t)(hw_memsize >> 10);
+
+ /* <rdar://problem/6610904> Reset protection when returning a previous large allocation? */
+ int32_t libSystemVersion = NSVersionOfLinkTimeLibrary("System");
+ if ((-1 != libSystemVersion) && ((libSystemVersion >> 16) < 112) /* CFSystemVersionSnowLeopard */) {
+ szone->large_legacy_reset_mprotect = TRUE;
+ } else {
+ szone->large_legacy_reset_mprotect = FALSE;
}
#endif
@@ -412,13 +412,11 @@
szone->debug_flags = debug_flags | MALLOC_PURGEABLE;
/* Purgeable zone does not support MALLOC_ADD_GUARD_PAGES. */
- if (szone->debug_flags & MALLOC_ALL_GUARD_PAGE_FLAGS) {
- if (!(szone->debug_flags & MALLOC_GUARD_ALL)) {
- // Don't report when MallocGuardEdges == "all".
- malloc_report(ASL_LEVEL_INFO, "purgeable zone does not support guard pages\n");
- }
- szone->debug_flags &= ~MALLOC_ALL_GUARD_PAGE_FLAGS;
- }
+ if (szone->debug_flags & MALLOC_ADD_GUARD_PAGES) {
+ malloc_report(ASL_LEVEL_INFO, "purgeable zone does not support guard pages\n");
+ szone->debug_flags &= ~MALLOC_ADD_GUARD_PAGES;
+ }
+
_malloc_lock_init(&szone->large_szone_lock);
szone->helper_zone = (struct szone_s *)malloc_default_zone;