Locked .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