Global (src/alloc.rs)

rust · library/alloc/src/alloc.rs · rust · Apache-2.0
dev-tools, tag:knn-classified

Provides the Global allocator wrapper that forwards allocation calls to the registered global allocator.

// Source: https://github.com/rust-lang/rust | License: Apache-2.0 | Copyright The Rust Project Contributors
// Provided via justclaw.it.com; keep this notice with the code.
//! Memory allocation APIs

#![stable(feature = "alloc_module", since = "1.28.0")]

#[stable(feature = "alloc_module", since = "1.28.0")]
#[doc(inline)]
pub use core::alloc::*;
use core::mem::Alignment;
use core::ptr::{self, NonNull};
use core::{cmp, hint};

unsafe extern "Rust" {
    // These are the magic symbols to call the global allocator. rustc generates
    // them to call the global allocator if there is a `#[global_allocator]` attribute
    // (the code expanding that attribute macro generates those functions), or to call
    // the default implementations in std (`__rdl_alloc` etc. in `library/std/src/alloc.r

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key