Static methods
Possible duplicates:
Garbage collection of static elements
The garbage collector will clean up static methods and static class
+1
a source to share
6 answers
duplicate: Garbage collection of static elements
Also I can mention when OBJECT will be built. The method and classes will not be collected.
public class TestClass
{
public static Hashtable h_object = new Hashtable();
}
TestClass.h_object = null;
//* here it has no more references and it will be added to GC.
+1
a source to share
static means that there is only one object of this type. the best example is the main method. it only exists once. so garbage collection will collect these objects too, but not automatically in the program, just at the end.
apart from what Lukas Shalkauskas said with "some_object". "some_other_obj" = null;
0
a source to share