Trevor,

I am almost finished a project which needs to sublaunch MemoPad and I had a lot of trouble with memory leaks in fields.

You really need to write a routine to clear every field when exiting your project, for example here is one field,

static void ActionCleanUp (void)
{
Char * ptr;
FieldPtr fld;
FormPtr frm;
// Find out if the field has been modified or if it's empty.
frm = FrmGetFormPtr (ActionForm);
fld = FrmGetObjectPtr (frm, FrmGetObjectIndex (frm, ActionPrevField));
ptr = FldGetTextPtr (fld);
FldReleaseFocus (fld);
// Release any free space in the field.
FldCompactText (fld);
// Clear the handle value in the field, otherwise the handle
// will be free when the form is disposed of.
FldSetTextHandle (fld, 0);
if (ptr != 0)
  MemPtrFree(ptr);   //free old text
FldDrawField(fld);

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

Reply via email to