> >> I have a program that creates memory handles for modifying text fields.
> >> ... Do I then need to do a MemHandleFree?
> 
> > If you're using FldSetTextHandle() you must not release the memory!
> > See API Docs under FldSetTextHandle() for more details.
> 
> Fields manage their own memory including cleanup on form closing.  
> But fields do NOT clean up old memory if you're putting in new memory.
> You have to get the old memory before putting in the new, and then clean
> up the old memory after.

  how about this: :)

---
  new_handle = MemHandleNew(size);

  {
    Handle old_handle = FldGetTextHandle(fld);
    FldSetTextHandle(fld, new_handle);
    // do the form
    FldSetTextHandle(fld, old_handle);  
  }

  MemHandleFree(new_handle);
---

  it does the same thing :) however it makes your code look cleaner
  as you can match the New with the Free within your code :)

  i will now fix my code :)) thanks for pointing this out :) i assume
  the same applies for Lists :) nice little memory leaks :)

az.
--
Aaron Ardiri 
Java Certified Programmer      http://www.hig.se/~ardiri/
University-College i G�vle     mailto:[EMAIL PROTECTED]
SE 801 76 G�vle SWEDEN       
Tel: +46 26 64 87 38           Fax: +46 26 64 87 88
Mob: +46 70 656 1143           A/H: +46 26 10 16 11

Reply via email to