Would there be a performance increase if the class implements the
idisposable interface and calls the dispose method (and then remove it
from the queue for the garbage man so he doesn't have to stop)?
http://msdn.microsoft.com/en-us/library/system.idisposable(v=VS.80).aspx

On Sep 27, 10:07 am, Stephen Russell <[email protected]> wrote:
> On Sat, Sep 25, 2010 at 4:07 AM, BB <[email protected]> wrote:
> > The problem is that I don't attach anything.
> > Try this test code pls, so I will be sure that I am not crazy ^^...
>
> > Public Class CMyClass
> >    Inherits Object
> >    Private fPropertyOne As String
> >    Private fPropertyTwo As Integer
> >    Public Event OnSomeEvent(ByRef vSender As Object)
> > End Class
>
> > Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles btn1.Click
>
> >        Dim i As Integer
> >        For i = 0 To 1000
> >            Dim oEl As New CMyClass()
> >            Console.WriteLine("element created " &
> > GC.GetTotalMemory(True))
> >            oEl = nothing
> >            Console.WriteLine("element after destroying " &
> > GC.GetTotalMemory(True))
> >        Next
> >    End Sub
> > End Class
>
> ---------------------
>
> oEI = nothing is just a marker for the garbage collector to use in the
> future.  It is not going to be performed on your time and if you call
> it to be performed your performance will get worse.
>
> Think of it as "You are on M$ time" They will decide what is good for
> you and you need not worry about it.
>
> ;->
>
> --
> Stephen Russell
>
> Sr. Production Systems Programmer
> CIMSgts
>
> 901.246-0159 cell

Reply via email to