.Net Memory Management
-
Wednesday, February 29, 2012 10:17 AM
Hi,
What occurred at the memory :
Class D{int i;}
Class X
{
public D dx;
}
Class Y
{
public D dy = new D();
}
Class Main
{
X x1 = new X();
Y y1 = new Y();Main()
{
x1.dx = y1.dy;
y1 = null;
}
}
At this example the .Net Garbage Collector will release the memory of the class Y for the ref y1, but the x1.dx will still a live.
Im right yes/no?
Thnx,
khalil
All Replies
-
Wednesday, March 07, 2012 4:42 PM
Yes, that is correct. Since the instance of D is still referenced at x1.dx, the gc will not touch it until x1 is out of scope.
Kind regards,
Jonny------
MSDN Hotline http://msdn-online.de/hotline | Feedback http://www.msdn-online.de/dialog/ | Messenger MSDN-Messenger-Hotline@hotmail.de- Edited by Jonny Best Wednesday, March 07, 2012 4:42 PM
- Proposed As Answer by Mr. Javaman II Thursday, March 08, 2012 8:07 PM
- Marked As Answer by khalil salhi Monday, July 23, 2012 7:22 AM
-
Monday, July 23, 2012 7:23 AM
I know that, i asked you inorder to prove to the developer in my team that i were correct.
Thnx,
khalil

