On Wed, 28 Nov 2001, Craig Deelsnyder wrote: > Question about responsibility for freeing memory. Suppose I declare an > array of 'strings': > > Char** args = (Char**)MemPtrNew(11*sizeof(Char*)); > > then I populate some of the array: > > args[0] = (Char*)MemPtrNew( StrLen(text) + 1 ); > ..... > args[1] = (Char*)MemPtrNew( StrLen(text) + 1 ); > ..... > > Now, do I have to free the memory of each of the elements in the array, or > can I simply just free the memory of the 'args' variable, and it will in > turn free the args[0], etc.?
general rule of thumb.. for every MemPtrNew, you need a MemPtrFree :) if you free args, it wont free args[0..n] // az [EMAIL PROTECTED] http://www.ardiri.com/ -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
