-
hi,
I am developing a project which uses one Midform with lots of child forms in it. Those have lots of images and controls inside them.
I read earlier that memory would not be freed up when I unload any of the child forms inside the MDiform unless I close the whole program..!! is that right??
so if I have 10 Mdi child forms in my application.. (unloading one before loading the next).. would make no difference. and would take up memeory for all 10 of them??
anyone please comment on this...
is that right? if so any solutions? why?
thanks a lot!
Abdul
-
As far as I know, the memory is relaesed when the parent form is closed. This is not necessarily the same as the App closing.
Cheers,
P.
-
re:
but what if the whole app is a parent Mdi?
my app launches one Mdi, which everything is done in it.. i.e one parent Mdi with a bunch of child forms in it..
would that mean my app will take as much memory as the amount of child forms have?? (as I understand now that even if I unload those childs they still dont release the momory! thus the more child forms that are loaded the more memory used up EVEN if the prevous child is unloaded).
any idea? anyone?
thanks again
Abdul
-
I use to set my child forms to nothing before I unload them.
Code:
Sub Form1_Unload
Set Form1 = Nothing
Unload Me
End Sub
-
re:
I dont know if that would work... can you do that in design time? it does not seem to change the form form child to normal.
have you been succesfull though? (in releasing/freeing up memeory by this method)
any thoughts?
thanks
Abdul
-
Well yes I was able to free some memory using this method. You must test it though, because depending on your application the Set to Nothing might not be accepted (object required error) if you stil need the object or there are links to other codes / memory.
I would be interested also in knowing some other opinions on this :)
-
re:
thanks.. I dont have any objects in within any for the child forms that depend on any other (if you see what I mean).
When you used this method (adding the set form1 = nothing before any unload me statement) was there any visual difference? I found no difference in how it closed.. (I was expencting some sort of flicker or maybe some indication that the form was changed from child to normal then unloaded..).. how did you test it to see that it did accualy free memory? did it not free memeroy before you added that line of code before the unload me instruction?
thanks a lot!
Abdul