[cfe-dev] How to disable/override __builtin_operator_new/delete?

Eric Fiselier via cfe-dev cfe-dev at lists.llvm.org
Wed Mar 21 21:31:29 PDT 2018


There is no way to disable __builtin_operator_new/delete or prevent libc++
from using it.

I would be interested to get some more details about your particular case.
Ideally a reproducer
I could play with. Or at least provide some sort of stack trace and error
log.

I'm not too familiar with the optimization aspects of
__builtin_operator_new/delete, but the behavior
you're observing sounds like a bug. Either in LLVM/Clang/libc++ or within
your build. My suspicion
is that an ODR violation is involved.

/Eric




On Wed, Mar 21, 2018 at 4:43 PM, James Robertson via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hi,
>
> I'm trying to get my own global operator new/delete calls working that my
> memory manager plugs into.
>
> This code is working fine on MacOS (clang) and Windows (Visual Studio),
> but on iOS I have a third party library (lohmann json) returning a
> std::string object which appears to have been allocated through my
> ::operator new function (I.e., my memory manager) but is being deleted
> through __builtin_operator_delete.  Which just results in a crash almost
> immediately after the app starts.
>
> So how do I disable these particular builtin functions?
>
> Cheers,
> James
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180321/961cb3de/attachment.html>


More information about the cfe-dev mailing list