tshad wrote:
If I create an object (instantiate) then do it again using the same Pointer,
will I leave the old object hanging around wasting memory?
Would this create a memory leak or would it be taken care of when I leave
the function?
************************************************** ********
Sub ActiveJobEdit_Click(s as Object, e as ImageClickEventArgs)
Dim newPosition as Position = new Position(oLabel.Text)
...
newPosition = new Position(otherLabel.Text)
session("newPosition) = newPosition
End Sub
************************************************** ********
Thanks,
Tom
What you are doing would not create a memory leak - but, it also
wouldn't be taken care of when you leave the function... At least,
probably not :)
See, object life time in .NET is non-deterministic. It is controled by
the garbage collector, and that generally only runs when your
application is under memory pressure. Here is an article that
gives a rundown of Memory management in .NET
http://msdn.microsoft.com/msdnmag/is...I/default.aspx http://msdn.microsoft.com/msdnmag/is...2/default.aspx
The code is C# and the articles are a bit old, but it covers most of
the basics. You can also read the documentation, for more details.
--
Tom Shelton [MVP]