Skip to content

finalize()函数与System.gc()问题#1

Open
newbeess wants to merge 5 commits into
masterfrom
dev
Open

finalize()函数与System.gc()问题#1
newbeess wants to merge 5 commits into
masterfrom
dev

Conversation

@newbeess
Copy link
Copy Markdown
Owner

System.gc()用于收集由new运算符创建的位于堆上的内存空间,JVM只有在内存空间不够用的情况下才会进行垃圾回收,我们可以使用System.gc()来提醒JVM进行垃圾回收(JVM不保证一定会回收)。
finalize()在JVM回收垃圾的时候,会被调用来清理非Java代码产生的内存。

@newbeess
Copy link
Copy Markdown
Owner Author

y

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant