I am talking about things like this:
public class GCExample {
public static void main(String[] args) {
A a1 = new A();
A a2 = new A();
a1.myA = a2;
a2.myA = a1;
Type: Posts; User: Cornix
I am talking about things like this:
public class GCExample {
public static void main(String[] args) {
A a1 = new A();
A a2 = new A();
a1.myA = a2;
a2.myA = a1;
It will not only collect objects with no reference pointing to them. It can also collect objects that are referenced.
How exactly the gc works is not that important, but it might be something like a...
You dont need to care about things like that. The garbage collector will find everything that is not using a System resource. (Threads, IO-Streams, etc)
Dont try to over-optimize your code before...