Okay thanks everyone, sorry if I'm using this forum inappropriately! I wont
ask generic C++ questions every again, I promise.
The following code aught to work properly then.
char ** memptr;
memptr = (char**)MemPtrNew(sizeof(char*) * items);
memptr[n] = (char *)MemPtrNew(StrLen("Some String") + 1);
for(UInt i = 0; i < (sizeof(memptr)/sizeof(char *)); i++)
{
MemPtrFree(memptr[i]);
}
MemPtrFree(memptr);
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Jeff
Wheeler
Sent: Wednesday, July 11, 2001 3:04 PM
To: Palm Developer Forum
Subject: Re: Memory Management question
> char ** memptr;
> memptr = (char**)MemPtrNew(sizeof(char*) * items);
> memptr[n] = (char *)MemPtrNew(StrLen("Some String") + 1);
> MemPtrFree(memptr);
>
> Does this statement code free up all the memory that was allocated for the
> array of strings?
Yes, it frees the memory allocated for the array of strings, but no, it does
not free the individual strings pointed to by the elements of this array.
For every successful MemPtrNew(), you need a MemPtrFree().
Jeff
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/