Posted on 1997-08-10
(A) and (B) are two forms.
I have been using createnew to create a form (B) just before the call to its (B) Show method. When the form (B) is closed I then call form(B).release method upon returning to the calling form (A).
I find, by using the 'UBEAUT' new IDE enhancement in DELPHI 3, that the db components (table, datasource,query) have not been freed (as they report as a pointer - not NIL). This of course means that the form (B) cannot then be freed.
So in the form (B) I have included calls to the various db component's Destroy methods. I had hoped that this would allow the form (B) to *DIE*. No such luck.
Next time I need to open this form (B) I check if it is NIL and if so recreate it. But it is not NIL so I attempt to access a component (such as a label for changing the forms title or what ever) and BANG the label has a NIL pointer and therefor causes a ACCESS VIOLATION and messes up the application.
Of course one could just leave the form 'ALIVE' until the next time it is needed but this application has some 30 forms and uses 25%-40% of system resources. I would like to know if it is normal for responsible PC programmers to want to uses a few resource at any one time as possible by destorying invisible forms or have I spend too much time over the years programming on machines with < 1meg or memory