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
  • src/zone.c

    From 4abaee5d13a54c677cd132c481dbf7621f785fec Mon Sep 17 00:00:00 2001
    From: Mike Hommey <mh@glandium.org>
    Date: Fri, 8 Jul 2016 13:28:16 +0900
    Subject: [PATCH 1/2] Avoid getting the same default zone twice in a row.
    
    847ff22 added a call to malloc_default_zone() before the main loop in
    register_zone, effectively making malloc_default_zone() called twice
    without any different outcome expected in the returned result.
    
    It is also called once at the beginning, and a second time at the end
    of the loop block.
    
    Instead, call it only once per iteration.
    ---
     src/zone.c | 5 +++--
     1 file changed, 3 insertions(+), 2 deletions(-)
    
    diff --git a/src/zone.c b/src/zone.c
    index ca235da..9432f45 100644
    a b register_zone(void) 
    246246        malloc_zone_register(&zone);
    247247
    248248        do {
    249                 default_zone = malloc_default_zone();
    250249                /*
    251250                 * Unregister and reregister the default zone.  On OSX >= 10.6,
    252251                 * unregistering takes the last registered zone and places it
    register_zone(void) 
    272271                        malloc_zone_unregister(purgeable_zone);
    273272                        malloc_zone_register(purgeable_zone);
    274273                }
    275         } while (malloc_default_zone() != &zone);
     274
     275                default_zone = malloc_default_zone();
     276        } while (default_zone != &zone);
    276277}
Note: See TracBrowser for help on using the repository browser.