What is the garbage collector in Java?

前端 未结 16 1185
故里飘歌
故里飘歌 2020-11-22 11:24

I am new to Java and confused about the garbage collector in Java. What does it actually do and when does it comes into action. Please describe some of the properties of the

16条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-22 11:46

    Automatic garbage collection is a process where the JVM gets rid of or keeps certain data points in memory to ultimately free up space for the running program. Memory is first sent to heap memory, that is where the garbage collector (GC) does its work, then is decided to be terminated or kept. Java assumes that the programmer cannot always be trusted, so it terminates items it thinks it doesn't need.

提交回复
热议问题