Detecting and/or preventing global_allocator from a dependency

I've spent quite a time debugging a possible memory leak problem, but eventually turns out that the reason was (my own) a dependency that mistakenly declared a non-optimal global_allocator which was behind a feature gate (declared as a default unfortunately).

I noticed this only after trying to use a custom allocator for finding heap allocations.

Is there a way to notice if a dependent crate will try to inject its own global_allocator? I'm also trying to find if there's some global flag that I could put into the main crate to prevent a global allocator from dependencies.

Thank you!

2 Likes