Another garbage collection question# Java - 爪哇娇娃
R*Z
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.
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.