• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Why do I get the message 'pointer being freed was not allocated' in my dynalib?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why do I get the message 'pointer being freed was not allocated' in my dynalib?


  • Subject: Why do I get the message 'pointer being freed was not allocated' in my dynalib?
  • From: Yuri <email@hidden>
  • Date: Sat, 15 Jan 2011 15:45:59 -0800

I have the app that works in linux and BSD, and not in MacOS.

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?

Yuri
_______________________________________________
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


  • Follow-Ups:
    • Re: Why do I get the message 'pointer being freed was not allocated' in my dynalib?
      • From: Jonas Maebe <email@hidden>
  • Prev by Date: Re: Turn off precompiled header for one file?
  • Next by Date: Re: Why do I get the message 'pointer being freed was not allocated' in my dynalib?
  • Previous by thread: Re: Adding subprojects to main project
  • Next by thread: Re: Why do I get the message 'pointer being freed was not allocated' in my dynalib?
  • Index(es):
    • Date
    • Thread