Hi Michael,
In your second case, how are you using JoeShmoeTxt?
Some thoughts in advance:
The declaration
CharPtr JoeShmoeTxt[JOE_SIZE];
is the same as
char* JoeShmoeTxt[JOE_SIZE];
These define an array of pointers to character strings, not a character
string.
In your second case, it appears that you are trying to create a stack-based
variable like this:
char JoeShmoeTxt[JOE_SIZE];
The above defines an array of characters (a string) which is JOE_SIZE bytes
long (including the null terminator). This variable resides on the stack
when it is in scope. So, there is nothing to allocate and nothing to free.
I hope this is helpful.
-----Steve Jackson
"Michael P. Hutchens, M.D., M.A." <[EMAIL PROTECTED]> wrote in
message news:11664@palm-dev-forum...
>
> I gather there are two ways of handling CharPtr's:
>
> VoidHand JoeShmoeH;
> CharPtr JoeShmoeTxt;
>
> MemHandleNew JoeShmoeH(JOE_SIZE);
> JoeShmoeTxt = MemHandleLock(JoeShmoeH);
>
> and
> CharPtr JoeShmoeTxt[JOE_SIZE];
>
> Now my question is this: in the first case, one simply releases the
> memory when one finishes with:
>
> MemHandleUnlock(JoeShmoeH);
> MemHandleFree(JoeShmoeH);
>
> How do you assure that the memory in the second case is released and
> not leaked?
> --
> ----------------------------------------------------------------------
> Michael Hutchens PregCalc 3.0 Professional:
> [EMAIL PROTECTED] http://www.thenar.com/pregcalc
> FloChart:
> Please quote previous http://www.thenar.com/chart
>
> correspondence when discussing Ranson:
> technical support issues. http://www.thenar.com/Ranson
>
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/