Results 1 to 7 of 7

Thread: Mid child forms dont release memory when unloaded??

  1. #1

    Thread Starter
    Hyperactive Member Abdulrahman's Avatar
    Join Date
    Oct 2000
    Location
    Scotland
    Posts
    281
    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
    1+1=3
    make life simple, use a calculator!

  2. #2
    Fanatic Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    1,008
    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.
    Not nearly so tired now...

    Haven't been around much so be gentle...

  3. #3

    Thread Starter
    Hyperactive Member Abdulrahman's Avatar
    Join Date
    Oct 2000
    Location
    Scotland
    Posts
    281

    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
    1+1=3
    make life simple, use a calculator!

  4. #4
    Fanatic Member wildcat_2000's Avatar
    Join Date
    Nov 2000
    Location
    Italy
    Posts
    727
    I use to set my child forms to nothing before I unload them.

    Code:
    Sub Form1_Unload
    Set Form1 = Nothing
    Unload Me
    End Sub
    When your car breaks down,
    close all windows and retry

    => please rate all users posts! <=

  5. #5

    Thread Starter
    Hyperactive Member Abdulrahman's Avatar
    Join Date
    Oct 2000
    Location
    Scotland
    Posts
    281

    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
    1+1=3
    make life simple, use a calculator!

  6. #6
    Fanatic Member wildcat_2000's Avatar
    Join Date
    Nov 2000
    Location
    Italy
    Posts
    727
    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
    When your car breaks down,
    close all windows and retry

    => please rate all users posts! <=

  7. #7

    Thread Starter
    Hyperactive Member Abdulrahman's Avatar
    Join Date
    Oct 2000
    Location
    Scotland
    Posts
    281

    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
    1+1=3
    make life simple, use a calculator!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width