Not sure about the memory leak, as I also used SelectDay() without a
problem.  I did, however, notice that you're not allocating enough space for
your alertStr.  You requested 12 bytes, but the string is 24 bytes including
a null.

Alternatively, you can maintain a table of pointers to strings so you don't
even need to allocate temporary storage.  Just pass the pointer to
SelectDay().

Even better, store these strings in a resource file so that you're one step
closer to internationalization. :-)

Now get some sleep.

Michael Yam
www.ytechnology.com


Michael P. Hutchens, M.D., M.A. <[EMAIL PROTECTED]> wrote in
message news:13808@palm-dev-forum...
>
> Memory leaks suck.
>
> Mostly, they're my fault, and I've been learning a bit lately about
> how not to be such a pig with memory.  This one, however, might not
> be my fault, and I'm losing a ton of memory over time to it.
>
> The following line loses 134 bytes per execution:
>
> handled=SelectDay(selectDayByDay,&kEDDmonth, &kEDDday, &kEDDyear,
> "Enter Date for GA Calc");
>
> I thought maybe I was losing the CharPtr, since the space is
> allocated, but I don't have any way of knowing if it's de-allocated.
> So I tried:
>
> alertH=MemHandleNew(12);
> alertStr=MemHandleLock(alertH);
> StrCopy(alertStr, "Enter Date for GA Calc:");
> handled=SelectDay(selectDayByDay,&kEDDmonth,&kEDDday,&kEDDyear, alertStr);
> MemHandleUnlock(alertH);
> MemHandleFree(alertH);
>
> That still lost 134 bytes.  What am I missing?
>
> -----------------------------------------------------------------------
> 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/

Reply via email to