Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

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

wants to merge 5 commits into from

Conversation

newbeess
Copy link
Owner

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

@newbeess
Copy link
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