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

Revisit the choice of memory allocator? #21090

Open
SimonSapin opened this issue Jun 24, 2018 · 5 comments
Open

Revisit the choice of memory allocator? #21090

SimonSapin opened this issue Jun 24, 2018 · 5 comments

Comments

@SimonSapin
Copy link
Member

@SimonSapin SimonSapin commented Jun 24, 2018

Historically, Rust has shipped a copy of jemalloc as part of the standard library on most platforms (but notably not Windows) and used it as the default memory allocator for Rust code.

These days with the #[global_allocator] attribute, Servo can and does override the allocator used by the standard library. But we’ve kept the same config (jemalloc, now through https://crates.io/crates/jemalloc-sys, on all platforms except Windows) just because that used to be the default. Now that we control this choice, we can reconsider it.

Should we prefer jemalloc on Windows? Should we prefer not building and shipping and using our own copy of jemalloc on some other platforms, and use the system’s allocator?

For example, the system allocator appears to be jemalloc on recent Android versions. Using it would mean one less piece of code that we need to cross-compile (see #20645), and a smaller binary (though we probably have some low hanging fruit to pick there before this difference becomes significant: #18625).

CC @jdm, @pcwalton

@emilio
Copy link
Member

@emilio emilio commented Jun 25, 2018

It'd be nice to try out bmalloc and see if it makes a difference on performance / memory use. It's one of the things I'd like to try in Gecko as well. Also maybe worth checking Gecko's malloc as well?

@SimonSapin
Copy link
Member Author

@SimonSapin SimonSapin commented Jun 25, 2018

Gecko has a modified/tuned fork of an older version of jemalloc and gave up trying to rejoin upstream: https://bugzilla.mozilla.org/show_bug.cgi?id=1363992. Trying it in Servo would involve writing a standalone build system for it (perhaps similar to generate_build_data.py + build.rs in https://github.com/servo/mozangle).

@froydnj
Copy link
Contributor

@froydnj froydnj commented Jun 25, 2018

@glandium is experimenting with porting Gecko's fork of jemalloc to Rust; perhaps that would be a more suitable base to build from.

@SimonSapin
Copy link
Member Author

@SimonSapin SimonSapin commented Jun 25, 2018

Porting as in a rewrite, or FFI bindings?

@froydnj
Copy link
Contributor

@froydnj froydnj commented Jun 25, 2018

Pure Rust.

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.