Skip to content
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

关于Java的垃圾回收机制,下面哪些结论是正确的? #45

Open
strongant opened this issue Apr 3, 2017 · 1 comment
Open

Comments

@strongant
Copy link
Owner

A. 程序可以任意指定释放内存的时间
B. JAVA程序不能依赖于垃圾回收的时间或者顺序
C.程序可以明确的标识某个局部变量的引用不再被使用
D.程序可以显示地立即释放对象占用的内存

@strongant
Copy link
Owner Author

答案:B
解析:垃圾回收发生不可预知性,由于使用了不同的垃圾回收算法和垃圾回收机制,所以它有可能会定时执行,也有可能会等待CPU空闲时执行,也有可能和原生的垃圾收集一样,等到内存消耗出现极限时发生,与垃圾收集器的选择和具体的设置都有关系。

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

No branches or pull requests

1 participant