0
Answer

Freeing up resources after form close

Namit Dua

Namit Dua

16y
2.4k
1

Hi All,

  I created a small application to learn C# where a user opens new sub-forms (say x1, x2, ...) after clicking new button on one main form (say M). I noticed that even the sub forms x1,x2... are closed by user still the memory once increased stay as it is in taskmanager. Initially I thought that the sub-forms are not releasing all memory on close so I called this.dispose() in form_closed event. But still no luck. Then another reason could be that the object created under main form M needs to release resources because form M is responsible to call x1.show(). This is a guess and I am not sure this is the exact reason behind the problem, but if my guess is correct then another problem is how a parent form can be informed that the child form is closed now and later how a object defined in a form can be forced to release resources.

I hope I was able to explain my issue but still if you have any question please feel free to ask.