一個< - >乙< - 「ç< - > d < - >一...爪哇 - 循環垃圾收集
// A是firstNode,d是lastNode
if (length == 1)
{
firstNode = null;
lastNode = null;
firstNode.next = null;
firstNode.prev = null;
}
else
{
Node secondNode = firstNode.next;
Node secondToLast = lastNode.prev;
firstNode.next = null;
firstNode.prev = null;
lastNode.next = null;
lastNode.prev = null;
secondNode.prev = null;
secondToLast.next = null;
firstNode = null;
lastNode = null;
}
應作爲垃圾收集的候選人之間發送所有內容,我希望?
另請參閱http://stackoverflow.com/questions/1910194/garbage-collection-in-java-and-circular-references – polygenelubricants 2010-05-10 04:42:19
可能的重複[Java中的循環引用](http: //stackoverflow.com/questions/176745/circular-references-in-java) – polygenelubricants 2010-05-10 04:42:43