Ask a Question
Advertise on boostr.in
Organizational Research By
Surprising Reserch Topic
Experts Most Trusted Topic
how does java garbage collector handle self reference using -'java,garbage-collection'
how does java garbage collector handle self reference ¬†using -'java,garbage-collection'
Hopefully a simple question. Take for instance a Circularly-linked list:
¬†¬†private listContainer next;
¬†¬†public void setNext(listContainer next)
¬†¬†¬†¬†this.next = next;
¬†¬†private listContainer entry;
Now since it's a circularly-linked list, when a single elemnt is added, it has a reference to itself in it's next variable. When deleting the only element in the list, entry is set to null. Is there a need to set ListContainer.next to null as well for Garbage Collector to free it's memory or does it handle such self-references automagically?
Sep 7, 2015
to add a comment.
Related Hot Questions
Walkin Jobs Opening
Government Jobs Opening