Re: Why do I get the message 'pointer being freed was not allocated' in my dynalib?
Re: Why do I get the message 'pointer being freed was not allocated' in my dynalib?
- Subject: Re: Why do I get the message 'pointer being freed was not allocated' in my dynalib?
- From: Jonas Maebe <email@hidden>
- Date: Sun, 16 Jan 2011 01:08:31 +0100
On 16 Jan 2011, at 00:45, Yuri wrote:
> I will describe the situation in hopefully relevant bits of information:
> 1. My app is C++ app that defines 'operator new' which just calls 'malloc' for its own consumption and defines 'operator delete' that just calls 'free'.
> 2. App also uses -Wl,--export-dynamic so that operator new and operator delete become public.
> 3. App loads C++ dynamic lib libMyLib1.dylib which allocates std::string and returns it to the main app.
> 4. App loads another C++ dynamic lib libMyLib2.dylib which attempts to reassign this std::string instance with some other value. *** Here I get an error: 'pointer being freed was not allocated' ***
> 5. Both dylibs libMyLib1.dylib and libMyLib2.dylib are loaded with dlopen with RTLD_LAZY|RTLD_GLOBAL flags.
> 6. Another interesting fact is that I see /usr/lib/libMallocDebug.A.dylib linked into my process at the time of failure (vmmap). I don't link with it and and don't have it in any env vars.
> 7. Setting DYLD_FORCE_FLAT_NAMESPACE env var magically cures the error message.
>
> Why do I get this error message?
See http://blogs.embarcadero.com/eboling/2010/02/16/5656/#comment-77
Jonas _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden