Topic: 【求助】关于垃圾收集的一个疑惑 |
Print this page |
1.【求助】关于垃圾收集的一个疑惑 | Copy to clipboard |
Posted by: Starcraft Posted on: 2003-12-09 11:08 class TestA Which two statements are true after line 15, before main completes? (A. Line 15 causes a stack overflow. B. An exception is thrown at runtime. C. The object referenced by a is eligible for garbage collection. D. The object referenced by b is eligible for garbage collection. E. The object referenced by a is not eligible for garbage collection. F. The object referenced by b is not eligible for garbage collection. 相关的解释: This is a typical example of the island of isolation. On line 15, the two objects TestA and TestB have a reference to one an other. Therefore, the correct answers are C. and D. A key point to remember is that an object that is referenced by another object can be eligible for garbage collection if the two objects form an island of isolated objects. |
2.Re:【求助】关于垃圾收集的一个疑惑 [Re: Starcraft] | Copy to clipboard |
Posted by: Starcraft Posted on: 2003-12-09 11:13 在方法本地创建的对象当方法返回时就符合垃圾收集的条件,除非它被导出到方法以外(即它被返回或者作为异常抛出)。 所以a和b都满足回收的条件,所以是CD,不知道这样理解是否正确。 对于本题一知半解,特别搞不太清楚他那些红色的内容到底是什么意思。谁能帮助解释一下么? |
3.Re:【求助】关于垃圾收集的一个疑惑 [Re: Starcraft] | Copy to clipboard |
Posted by: rostone Posted on: 2003-12-09 13:59 把main()看成一个root, 从root开始trace不到的对象都eligible for garbage collection. |
4.Re:【求助】关于垃圾收集的一个疑惑 [Re: Starcraft] | Copy to clipboard |
Posted by: dingligang Posted on: 2003-12-10 20:53 代码是不是有语法问题啊? |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |