What is the garbage collector in Java?

前端 未结 16 1190
故里飘歌
故里飘歌 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:59

    The garbage collector allows your computer to simulate a computer with infinite memory. The rest is just mechanism.

    It does this by detecting when chunks of memory are no longer accessible from your code, and returning those chunks to the free store.

    EDIT: Yes, the link is for C#, but C# and Java are identical in this regard.

提交回复
热议问题