Is following scenario called memory-leak in java? Is it not Garbage Collected? -


If an object variable is still pointing to some object which is of no use, then JVM The garbage will not collect the object and the object will be in memory to create memory leakage.

There is a possibility of memory leak in the above scenario. Why is not this garbage collection? Can anyone be expanded about this?

As long as someone refers to an object, JVM can not assemble it.

JVM determines that groups of objects are still used in search of an object of queries in the way of context from the root. This means that a group of objects that refers to each other, but is not referred to the rest of the system, the garbage will be collected.

So just pointing to an object will not prevent you from collecting garbage.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -