.Net Memory Management
-
29 Februari 2012 10:17
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
Semua Balasan
-
07 Maret 2012 16:42
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- Diedit oleh Jonny Best 07 Maret 2012 16:42
- Disarankan sebagai Jawaban oleh Mr. Javaman II 08 Maret 2012 20:07
- Ditandai sebagai Jawaban oleh khalil salhi 23 Juli 2012 7:22
-
23 Juli 2012 7:23
I know that, i asked you inorder to prove to the developer in my team that i were correct.
Thnx,
khalil