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

rustc: Allow changing the default allocator #27400

Merged
merged 1 commit into from
Aug 15, 2015

Commits on Aug 14, 2015

  1. rustc: Allow changing the default allocator

    This commit is an implementation of [RFC 1183][rfc] which allows swapping out
    the default allocator on nightly Rust. No new stable surface area should be
    added as a part of this commit.
    
    [rfc]: rust-lang/rfcs#1183
    
    Two new attributes have been added to the compiler:
    
    * `#![needs_allocator]` - this is used by liballoc (and likely only liballoc) to
      indicate that it requires an allocator crate to be in scope.
    * `#![allocator]` - this is a indicator that the crate is an allocator which can
      satisfy the `needs_allocator` attribute above.
    
    The ABI of the allocator crate is defined to be a set of symbols that implement
    the standard Rust allocation/deallocation functions. The symbols are not
    currently checked for exhaustiveness or typechecked. There are also a number of
    restrictions on these crates:
    
    * An allocator crate cannot transitively depend on a crate that is flagged as
      needing an allocator (e.g. allocator crates can't depend on liballoc).
    * There can only be one explicitly linked allocator in a final image.
    * If no allocator is explicitly requested one will be injected on behalf of the
      compiler. Binaries and Rust dylibs will use jemalloc by default where
      available and staticlibs/other dylibs will use the system allocator by
      default.
    
    Two allocators are provided by the distribution by default, `alloc_system` and
    `alloc_jemalloc` which operate as advertised.
    
    Closes rust-lang#27389
    alexcrichton committed Aug 14, 2015
    Configuration menu
    Copy the full SHA
    45bf1ed View commit details
    Browse the repository at this point in the history