mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-22 16:47:21 +03:00
Move zone registration to zone.c
This commit is contained in:
parent
2cfe6d67ef
commit
71a93b8725
4 changed files with 23 additions and 28 deletions
22
src/zone.c
22
src/zone.c
|
|
@ -159,8 +159,8 @@ zone_force_unlock(malloc_zone_t *zone)
|
|||
jemalloc_postfork_parent();
|
||||
}
|
||||
|
||||
malloc_zone_t *
|
||||
create_zone(void)
|
||||
void
|
||||
register_zone(void)
|
||||
{
|
||||
|
||||
zone.size = (void *)zone_size;
|
||||
|
|
@ -206,5 +206,21 @@ create_zone(void)
|
|||
zone_introspect.enumerate_unavailable_without_blocks = NULL;
|
||||
#endif
|
||||
#endif
|
||||
return (&zone);
|
||||
|
||||
/* Register the custom zone. At this point it won't be the default. */
|
||||
malloc_zone_register(&zone);
|
||||
|
||||
/*
|
||||
* Unregister and reregister the default zone. On OSX >= 10.6,
|
||||
* unregistering takes the last registered zone and places it at the
|
||||
* location of the specified zone. Unregistering the default zone thus
|
||||
* makes the last registered one the default. On OSX < 10.6,
|
||||
* unregistering shifts all registered zones. The first registered zone
|
||||
* then becomes the default.
|
||||
*/
|
||||
do {
|
||||
malloc_zone_t *default_zone = malloc_default_zone();
|
||||
malloc_zone_unregister(default_zone);
|
||||
malloc_zone_register(default_zone);
|
||||
} while (malloc_default_zone() != &zone);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue