source: trunk/dports/devel/jemalloc/files/0001-Avoid-getting-the-same-default-zone-twice-in-a-row.patch

Last change on this file was 152980, checked in by larryv@…, 3 years ago

jemalloc: Fix malloc zone registration on Sierra

Closes: #52238

File size: 1.2 KB
RevLine 
[152980]1From 4abaee5d13a54c677cd132c481dbf7621f785fec Mon Sep 17 00:00:00 2001
2From: Mike Hommey <mh@glandium.org>
3Date: Fri, 8 Jul 2016 13:28:16 +0900
4Subject: [PATCH 1/2] Avoid getting the same default zone twice in a row.
5
6847ff22 added a call to malloc_default_zone() before the main loop in
7register_zone, effectively making malloc_default_zone() called twice
8without any different outcome expected in the returned result.
9
10It is also called once at the beginning, and a second time at the end
11of the loop block.
12
13Instead, call it only once per iteration.
14---
15 src/zone.c | 5 +++--
16 1 file changed, 3 insertions(+), 2 deletions(-)
17
18diff --git a/src/zone.c b/src/zone.c
19index ca235da..9432f45 100644
20--- a/src/zone.c
21+++ b/src/zone.c
22@@ -246,7 +246,6 @@ register_zone(void)
23        malloc_zone_register(&zone);
24 
25        do {
26-               default_zone = malloc_default_zone();
27                /*
28                 * Unregister and reregister the default zone.  On OSX >= 10.6,
29                 * unregistering takes the last registered zone and places it
30@@ -272,5 +271,7 @@ register_zone(void)
31                        malloc_zone_unregister(purgeable_zone);
32                        malloc_zone_register(purgeable_zone);
33                }
34-       } while (malloc_default_zone() != &zone);
35+
36+               default_zone = malloc_default_zone();
37+       } while (default_zone != &zone);
38 }
39--
402.9.3
41
Note: See TracBrowser for help on using the repository browser.