Ani,

 

Has your second form (B) been responsible for creating and using any objects
during its lifetime. Form (B) may not be setup to dispose of these
correctly. Calling B.Free or FreeAndNil does not guarantee these other
objects are freed. You need to make sure that your destructor on (B) is
taking care of the disposal of all of these things.

 

Matt.

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of ani chakra
Sent: Sunday, 22 July 2007 5:07 p.m.
To: delphi@delphi.org.nz
Subject: [DUG] memory freeing option

 

Hi,

Is there any other way to free up memory consumed by a form containing a lot
of components, apart than free or FreeAndNil? I have code piece which is
like on a button click in one form A it calls execute method of another form
B which basically creates an object does its' work and then gets freed up by
using FreeAndNil, within try - finally - end block. 

What is baffling me is even after calling free, the memory is not freed. I
have tried using Release but its giving me Access Violations which I guess
due a large number of components placed on the form. I have read the delphi
2005 documentation ( I am using D2005) and it says for a modal form it hides
it when the form is closed. But, in my case the formStyle is set to
fsNormal. Also I am passing Nil as a parameter while creating form B to make
sure I am the one responsible for freeing up the memory. 

This is confusing me a lot.

Any pointers please...

Thanks!

_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe

Reply via email to