Re: Memory problem freeing strdup strings
Re: Memory problem freeing strdup strings
- Subject: Re: Memory problem freeing strdup strings
- From: Eric Albert <email@hidden>
- Date: Fri, 2 Mar 2007 09:38:16 -0800
On Mar 2, 2007, at 8:43 AM, Allen Cronce wrote:
I'm tracking down a memory problem in some legacy code. What's
happening
is MallocDebug will squawk with a warning anytime we try to "free" a
string allocated with "strdup".
So the following example code:
char* pszDebug = strdup("The sky is falling!");
free(pszDebug);
Will generate a warning like this:
libMallocDebug[MyApp-20004]: free: target application attempted to
free pointer 0x51b4f0 that is not pointing to a malloc block. The
address is not in memory used by the heap.
It looks like you're linking against libMallocDebug.a. Don't do
that. (We shouldn't even ship the .a.) Instead, just launch your
application with the MallocDebug application. That'll work properly
with strdup and other functions inside Libc which call malloc.
Hope this helps,
Eric
_______________________________________________
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