This is still broken. Citing myself from http://llvm.org/bugs/show_bug.cgi?id=15544:
The current ASan implementation of custom new()/delete() does not work reliably
on Mac (it may occasionally, but that's fake safety). Because the ASan runtime
library is a DSO, we end up having the main executable depend on two DSOs
(libstdc++ and libclang_rt.asan_osx_dynamic) each having their own new/delete
implementation. It's not determined which of them is picked at startup (I saw
both versions already).
Until we decide how to make ASan reliably intercept new/delete on OS X we just
need to disable our custom interceptors - that should fix the new_handler
I've disabled alloc_dealloc_mismatch and the corresponding tests on OS X for now.
Reported by ramosian.glider on 2013-04-23 12:16:26
A crazy idea follows.
What if we add a weak undefined symbol to asan runtime that can be resolved by libstdc++?
This way asan runtime will depend on libstdc++ (if it is linked to the executable at
all). This will force the lookup order.
Reported by firstname.lastname@example.org on 2013-04-23 12:28:17
This continues not to work on Mac, five years later, as far as I can tell. @mdtrent not sure whether I can tag you on GitHub or not, but I'll try. :-> Since this seems to be an issue with dynamic linking or some such, I thought it might interest you – or you might even have a fix for these guys!