Is the following script called memory leak in java? Isn't it garbage collection?

If any object variable still points to some object that is useless, then the JVM will not garbage collect this object and the object will remain in memory, creating a memory leak

There is a possibility of a memory leak in the above scenario .. Why is this not garbage? Can anyone clarify this?

+3
source share
7 answers

As long as someone has an object reference, it can be used, and the JVM cannot garbage collect it.

JVM , , . , , , , .

, , , .

+3

, .

, 100% , . " ", , , : , , - , , , . , : GC , , , , ( , ).

" " - , . "", . . , , .

+3

, , - , , . , , , .

+2

, , , , , - , . , , .

. , . .

+1

, JVM , ""? , , JVM , . GC Java , .

0

, JVM , . JVM .

0

Source: https://habr.com/ru/post/1729806/


All Articles