Is the global_allocator proc-macro per crate or per binary?

If I set the global allocator in my crate, will it be used by all the dependencies I have too? (that is my understanding currently).
If so, is there a possibility to set it per crate?

It is set for all the crates. You can't set an allocator per crate because code in a crate can deallocate an allocation made in another crate (e.g. Box is the same type for all the crates) so they can't use different allocators.

1 Like

Thought so, thanks.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.