由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - Another garbage collection question
相关主题
Re: help for running CPU intensive progrSingleton
a garbage collection questionWhere I can find comparison of JVMs
GC finalize()一问Java Question 151-199(end)
An experiment with JVM Garbage Collection SchemesRe: How to write to a file on server in an applet?
Java都在什么时候进行Garbage collection?Re: Can Web Services return Hash or Obje
garbage collection issue关于java执行SQL之后的内存问题?
Java/J2EE的面试中,关于garbage collection的问题应该怎么回答?请问hibernate这个功能如何实现?
soft reference和weak reference的区别spring AOP question
相关话题的讨论汇总
话题: obj话题: reference话题: garbage话题: gced话题: another
进入Java版参与讨论
1 (共1页)
R***Z
发帖数: 1167
1
In Java, suppose obj A has a reference to obj B, obj B has a reference to obj
C, and obj C has a reference to obj A. And no one else has any reference to
these 3 objs. So each of them has a reference count of 1. But they should
really be GCed because they are not reachable by any means. How does the
garbage collector know these 3 objs can be GCed? Thanks.
m******t
发帖数: 2416
2

obj
JVM does not use reference counting-based GC. These object would be GC'ed
without any problem.

【在 R***Z 的大作中提到】
: In Java, suppose obj A has a reference to obj B, obj B has a reference to obj
: C, and obj C has a reference to obj A. And no one else has any reference to
: these 3 objs. So each of them has a reference count of 1. But they should
: really be GCed because they are not reachable by any means. How does the
: garbage collector know these 3 objs can be GCed? Thanks.

g*****g
发帖数: 34805
3
http://www.brpreiss.com/books/opus5/html/page424.html
Algorithm like mark and sweep, does the job.
Note Java standard didn't specify how JVM should implement
its recycle scheme.

【在 m******t 的大作中提到】
:
: obj
: JVM does not use reference counting-based GC. These object would be GC'ed
: without any problem.

1 (共1页)
进入Java版参与讨论
相关主题
spring AOP questionJava都在什么时候进行Garbage collection?
Stack Frame of your JVM implementationgarbage collection issue
The shape of JVM stack frameJava/J2EE的面试中,关于garbage collection的问题应该怎么回答?
Top Ten Errors Java Programmers Make(10)soft reference和weak reference的区别
Re: help for running CPU intensive progrSingleton
a garbage collection questionWhere I can find comparison of JVMs
GC finalize()一问Java Question 151-199(end)
An experiment with JVM Garbage Collection SchemesRe: How to write to a file on server in an applet?
相关话题的讨论汇总
话题: obj话题: reference话题: garbage话题: gced话题: another