I have created a simple project in vb.net with 2 forms "mainform" and "childform". The "mainform" has a button that simply issues childform.show() and the "childform" has a button that issues me.close() and me.dispose().
When I run the project it shows the mainform. I click the button, it opens the childform. When I click the childform button it closes the childform and all appears well.
However when I profile this using JetBrains dotMemory I take a snapshot before opening the childform and then another one after opening and closing it. I compare the snapshots and it shows an instance of childform still alive. When I look at the dependency chain I see that it's being kept alive by an instance of "MyProject+MyForms".
If I open and close the childform multiple times and resnapshot there is still the one instance of childform alive.
Can anyone explain what is happening here?