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: Yuri <email@hidden>
- Date: Sat, 15 Jan 2011 18:26:42 -0800
On 01/15/2011 17:36, Ken Thomases wrote:
On Jan 15, 2011, at 6:31 PM, Yuri wrote:
On 01/15/2011 16:08, Jonas Maebe wrote:
See http://blogs.embarcadero.com/eboling/2010/02/16/5656/#comment-77
But I don't see why the lack of flat namespace causes memory allocator to not recognize the memory block. Is libSystem.B.dylib actually instantiated twice somehow?
I'm guessing that there's an object allocated with one operator new and deallocated with the operator delete which doesn't match. The two probably don't agree on what the base pointer is. For example, one of the implementations may take the pointer returned from malloc and add an offset to it so it can store some bookkeeping data "before" the object. The corresponding operator delete would subtract that offset to get the malloc'd pointer back given the object pointer. If the other pair of operators doesn't do exactly the same thing (and there's no reason to expect they would), then you can't mix and match them.
(There's also the distinct possibility that one pair of operators uses a sub-allocation strategy.)
Regards,
Ken
No, the only global operator new and operator delete present in the
system is just equivalent to malloc/free.
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