Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the jemallocator crate from crates.io instead of alloc_jemalloc #18836

Closed
wants to merge 1 commit into from

Commits on Oct 12, 2017

  1. Use the jemallocator crate from crates.io instead of alloc_jemalloc

    This compiles a new copy of jemalloc in addition to the one brought
    by the Rust standard library, but:
    
    * Only one of those ends up being linked
    * The increase in compile times is small (20 seconds on my laptop)
    
    This commit also adds an use of `#[global_allocator]` to select
    `jemallocator` as the default.
    `extern crate alloc_jemalloc;` used to decide the default,
    but it hasn’t since the `#[global_allocator]` attribute was introduced.
    
    `mallctl_set(b"epoch\0", 0_u64)` ends up calling `mallctl`
    with null pointers for the "old" value and its length,
    which isn’t the same as what we were doing before
    (passing the same pointer to both "old" and "new" parameters).
    My understanding is that this works too,
    since the important part is passing a new value:
    
    http://jemalloc.net/jemalloc.3.html#epoch
    >  epoch (uint64_t) rw
    >
    > If a value is passed in, refresh the data from which
    > the mallctl*() functions report values, and increment the epoch.
    > Return the current epoch. This is useful for detecting whether
    > another thread caused a refresh.
    SimonSapin committed Oct 12, 2017
You can’t perform that action at this time.