what to do when a stack frame is preventing a form from being garbage collected in vb.net.
details : I have created a form and call another form to be shown from the form.when the second form is shown the first is closed and disposed .But the first form is not being garbage collect. A stack frame is preventing it from being garbage collected what should I do
The garbage collector collects anything that's unreachable. So make sure that none of your code can reach the first form, and it will be collected eventually. Disposing is not the same thing as C's free().
One way you can get rid of your references in stack frames that cannot be closed is setting the reference to Nothing:
form1.Close()
form1 = Nothing