RE: why doesn't GC release the form's memory?
- From: "Anand[MVP]" <AnandMVP@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 18 Jul 2005 23:05:07 -0700
How do you know that the GC does not remove the form from memory? The GC does
a collection only when there is some kind of memory pressure. If not,
collections run at a lower frequency. The form will be collected when the
next collection runs.
Also if an object has a dispose method, it is always preferable that you
call it so that unmanaged resources are cleaned up fast.
--
Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com
"**Developer**" wrote:
> Private Sub KeyboardShortcuts()
>
> Dim ff As New FormHelp
>
> ff.Show()
>
> End Sub
>
> End Class
>
>
>
> Seems to me that ff is on the stack (?maybe not) and references the instance
> of FormHelp. After the sub exits ff nolonger exists and nothing references
> the form so why doesn't GC release the form's memory?
>
> Even if ff is not on the stack after the sub exits ff should be available
> for GC. No?
>
> Thank
>
>
>
.
- Follow-Ups:
- Re: why doesn't GC release the form's memory?
- From: **Developer**
- Re: why doesn't GC release the form's memory?
- References:
- why doesn't GC release the form's memory?
- From: **Developer**
- why doesn't GC release the form's memory?
- Prev by Date: Trouble installing Windows Service created with VB.NET
- Next by Date: RE: "Closing" a Form
- Previous by thread: Re: why doesn't GC release the form's memory?
- Next by thread: Re: why doesn't GC release the form's memory?
- Index(es):
Relevant Pages
|