Skip to content

#[global_allocator] in dependent crate can be optimized away #64402

Open
@jorendorff

Description

@jorendorff

jemallocator-global is a library intended to make jemalloc your allocator. It works by declaring a static allocator with #[global_allocator].

However, a downstream crate linked with jemallocator-global nonetheless uses the system malloc on MacOS X.

After experimenting a bit with #[global_allocator], it's behaving as though rustc optimizes away a whole crate if you don't seem to be using it; and it doesn't detect that the global allocator is always used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-allocatorsArea: Custom and system allocatorsA-linkageArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions