A frmCloseEvent may cause some memory to be released.  In particular, if there is 
memory in a field, it will be released on frmCloseEvent (specifically FrmDeleteForm 
takes care of this).  However in general, FormClose will NOT cause memory to be 
released.  Indeed, the general rule of thumb is:

If you allocate, you must de-allocate.

As a matter of form, if I de-allocate memory that a gui object knows about, I also 
tell the gui object that (i.e., set the releavant handle or pointer or whatever to 
NULL -- or, "if you give it to the GUI, you must take it from the GUI".)

I would suggest that your clean-up code may not have been quite correct.

-bob mckenzie, palmsource pdx

-----Original Message-----
From: N [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 07, 2002 1:20 PM
To: Palm Developer Forum
Subject: LIST MEMEORY LEAKS


*Please correct me if you find any of my assumption
wrong.  

I have this test application contains two forms.  Both
form contains a list which is populated from database
on FrmOpenEvent.  I have a function which allocates
memory and populates data and Callback function to
draw list.

When I exit my application it gives me one memory
leak, no matter how many times I toggle between these
two forms.   So I reached to a conclusion that
FrmCloseEvent automatically realse the memory of a
form if you are jumping to second form.  I don't have
any cleanup code on form close event. 

If I write code on FrmCloseEvent 
MemPtrFree(ListData) ;
handled = false ;

Application crashes when I try to jump to second form,
if I exit application from first form I get no memory
leaks and any crashes.  


Please help me understand this issue and suggest any
solution.

Thanks in advance.


__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com

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


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

Reply via email to