-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Tracking issue for rust-lang/rfcs#1183 rust-lang/rfcs#1974
Known bugs:
- The
#[global_allocator]
attribute doesn't work in modules global_allocator can not not be defined inside module #44113
Current status:
- Implemented in rustc: Implement the #[global_allocator] attribute #42727
- Stabilization checklist
- Remove docs from the unstable book
- Add docs to the real book
- Add jemalloc as a crates on crates.io (jemallocator)
- Once stable, link binaries to the system allocator by default Switch the default global allocator to System, remove alloc_jemalloc, use jemallocator in rustc #36963
- known issues Switch the default global allocator to System, remove alloc_jemalloc, use jemallocator in rustc #36963 (comment)
- valgrind doesn't work on jemalloc Valgrind doesn't report allocations with jemalloc on nightly #28224
- crates are gone Tracking issue for alloc_system/alloc_jemalloc #33082
A quick summary of the current state of this feature is that you can change the default global allocator via:
// Change this program's global allocator. At most one `#[global_allocator]`
// allowed in any crate graph.
#[global_allocator]
static ALLOCATOR: MyAlloc = MyAlloc;
// When defining a global allocator, the `Alloc` trait must be defined
// for `&'a T` instead of `T`
use std::heap::Alloc;
struct MyAlloc;
impl<'a> Alloc for &'a MyAlloc {
// ...
}
schneiderfelipe
Metadata
Metadata
Assignees
Labels
B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.