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

make it possible to swap out liballoc without recompiling Rust #18838

Closed
thestinger opened this issue Nov 10, 2014 · 2 comments
Closed

make it possible to swap out liballoc without recompiling Rust #18838

thestinger opened this issue Nov 10, 2014 · 2 comments
Labels
A-allocators Area: Custom and system allocators

Comments

@thestinger
Copy link
Contributor

It would be nice if it was possible to use an alternate global allocator without recompiling all of Rust. This would make it painless to swap in a build of jemalloc with assertions enabled which is a very useful debugging tool. It would also mean that the default liballoc could use a build of jemalloc without niche frills like heap profiling and zero/junk filling without forcing a recompile to use them.

If and when jemalloc gains support for sized deallocation in the reallocation APIs (either upstream or in Rust's fork), a sane implementation of the non-standard API could be done via the platform allocator API. This would make it possible to choose between jemalloc and the platform allocator without recompiling Rust.

@thestinger thestinger added the A-allocators Area: Custom and system allocators label Nov 10, 2014
@thestinger
Copy link
Contributor Author

I'm going to approach this another way. The replacement of the C library allocator will be a choice at compile-time but I don't think the sacrifices necessary to do the same thing for internal usage of jemalloc make sense.

It's still worth mixing jemalloc with the system allocator on most platforms, and those with jemalloc as the system allocator can be dealt with by having it call into that directly. It can just be hardcoded to use the system allocator in all cases on FreeBSD, etc.

@thestinger
Copy link
Contributor Author

It would be nice to swap an asserts build in and out but I don't think there's a sane way of doing it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-allocators Area: Custom and system allocators
Projects
None yet
Development

No branches or pull requests

1 participant