Skip to content
This repository has been archived by the owner on Feb 5, 2019. It is now read-only.

Fix for rust-lang/rust#34674 #15

Merged
merged 2 commits into from Jul 8, 2016

Conversation

glandium
Copy link

@glandium glandium commented Jul 8, 2016

This is the same fix as in jemalloc#420 , cherry-picked on top of what the rust compiler currently uses.

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.
On OSX 10.12, malloc_default_zone returns a special zone that is not
present in the list of registered zones. That zone uses a "lite zone"
if one is present (apparently enabled when malloc stack logging is
enabled), or the first registered zone otherwise. In practice this
means unless malloc stack logging is enabled, the first registered
zone is the default.

So get the list of zones to get the first one, instead of relying on
malloc_default_zone.
@rust-highfive
Copy link

r? @brson

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive
Copy link

warning Warning warning

  • Pull requests are usually filed against the master branch for this repo, but this one is against rust-2016-02-25. Please double check that you specified the right target!

@glandium glandium changed the title Fix for https://github.com/rust-lang/rust/issues/34674 Fix for rust-lang/rust#34674 Jul 8, 2016
@alexcrichton
Copy link
Member

Awesome, thanks!

@alexcrichton alexcrichton merged commit da18fef into rust-lang:rust-2016-02-25 Jul 8, 2016
@alexcrichton
Copy link
Member

cc jemalloc#427, where this was merged upstream
cc rust-lang/rust#34719, the rust update

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants