After you have finished with the list, do you MemPtrFree all the data
you allocated? The reason that you need to keep track of the variable
strArray is so that you may free it when you are done with it. You must
free every pointer in the array: MemPtrFree(strArray[n]) for every n <
recordindex (be sure to check that it is a valid pointer before freeing
it). Then free the whole array: MemPtrFree(strArray).

And no, don't loop MemPtrNew until it gives you what you want, because
that will most likely end up in an infinite loop. It is not giving you
the memory you need, because it may have run out of memory because you
are not freeing memory when you are done with it.

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:bounce-455220-
> [EMAIL PROTECTED] On Behalf Of druid
> Sent: Friday, August 19, 2005 9:51 AM
> To: Palm Developer Forum
> Subject: RE: Run function 19 times then it crash's I know what but not
why
> 
> There's a couple of things that look suspicious.
> >You should check the return value from MemPtrNew instead of using it
> blindly with confidence that a real new pointer is going to come back,
my
> guess is it's returning 0. <
> 
> 
> >You seem to be allocating an awful lot of MemPtrNew statements
without
> any MemPtrFree? <
> I have tried MemPtrFree inside the routine, and it's fine
> until the second pass, then it faults on a MemRelease error.
> 
> So you think this is not being created each time the routine
> is called. ?
> If this is the case do I put a loop in until the pointer is actualy
> created.?
> 
> Also,
> Char **strArray = NULL;
> Ok I can change this to a global
> but why would that matter becuse its done its work, and its
> recreated when the routine is called again ?
> 
> >You're passing strArray to a LstSetLstChoices, but the pointer will
be
> invalid when you exit your function.<
> 
> --
> For information on using the PalmSource Developer Forums, or to
> unsubscribe, please see http://www.palmos.com/dev/support/forums/



-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to