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

Including jemallocator-global doesn't actually enable jemalloc on MacOS X #135

Open
jorendorff opened this issue Sep 11, 2019 · 3 comments

Comments

@jorendorff
Copy link

I took an existing program, added a dependency on jemallocator-global in its Cargo.toml, built it with --release, and ran it under a profiler (Instruments). Observed: The profiler found stacks under libsystem_malloc.dylib. Expected: stacks under a statically linked jemalloc.

Depending directly on the jemallocator crate instead, and declaring a #[global_allocator] static Jemalloc in the binary crate, works fine.

I'm using stable Rust 1.37: rustc 1.37.0 (eae3437df 2019-08-13)

@jorendorff
Copy link
Author

I think this is an upstream bug. Filed rust-lang/rust#64402 .

@gnzlbg
Copy link
Owner

gnzlbg commented Sep 12, 2019

Oh, so if the edition is set to Rust 2018, and one does not use extern crate jemallocator_global;, the whole crate is optimized away?

@gnzlbg
Copy link
Owner

gnzlbg commented Sep 12, 2019

@jorendorff we can probably add #[used] here to work around this, could you give it a try and see if adding #[used] to the jemallocator-global crate fixes this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants