snmalloc
snmalloc copied to clipboard
Does it need "pub" keyword to access outside a module?
Since it provides a Rust wrapper snmalloc-rs, the document suggests
#[global_allocator]
static ALLOC: snmalloc_rs::SnMalloc = snmalloc_rs::SnMalloc;
for a Rust program. If a Rust project has multiple modules, should it add a "pub" keyword before "static" to share it for all modules?
Please refer to https://doc.rust-lang.org/std/alloc/index.html to see the usage of global allocators. The declaration is to make snmalloc replace all allocation hooks. Users typically does not use the allocation functions of such global objects directly.