G
Guest
If a reference to an object or an array is set to null, will the object/array
and all of it’s members/elements be garbage collected as well (Assuming that
no other references are held on the members/elements, and none of these
members/elements hold references to unmanaged resources.)?
For example:
public class A
{
public A(){}
}
..
..
..
A[] A_array = new A[5];
for(int i = 0; i < 5; i++)
{
A_array = new A();
}
A_array = null; // Will all of A_array’s elements be garbage collected here?
thanks
and all of it’s members/elements be garbage collected as well (Assuming that
no other references are held on the members/elements, and none of these
members/elements hold references to unmanaged resources.)?
For example:
public class A
{
public A(){}
}
..
..
..
A[] A_array = new A[5];
for(int i = 0; i < 5; i++)
{
A_array = new A();
}
A_array = null; // Will all of A_array’s elements be garbage collected here?
thanks