作者uopsdod (pcman)
看板Programming
标题[问题] Java garbage collection
时间Sun Dec 18 14:02:35 2016
不知道大家觉得下面题目的答案是多少?
我不确定是单选还是多选,我自己觉得只有3是对的,想跟大家讨论看看!
-------------------------------------------------------------------
You are concerned that your program may attempt to use more memory than
is available.
To avoid this situation you want to ensure that the Java Virtual Machine will
run its garbage collection just before you start a complex routine.
What can you do to be certain that garbage collection will run when you want?
1) You cannot be certain when garbage collection will run.
2) Use the Runtime.gc() method to force garbage collection.
3) Ensure that all the variables you require to be garbage collected are
set to null.
4) Use the System.gc() method to force garbage collection.
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 1.200.201.79
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Programming/M.1482040957.A.242.html
1F:→ sometimes4: ans:1 1.163.154.133 12/18 22:22
2F:→ shadowjohn: ans:1 140.134.48.253 12/19 13:33