title: Garbage collection of a instances with circular reference
body: <p>I know that when an object has no references, the garbage collector frees the memory. But I have a doubt.</p>
  
  <p>I have a class that is represented by a tree:</p>
  
  <pre><code>class MyNode
  {
      string Name;
      List&lt;MyNode&gt; Descendants;
      MyNode Parent;
  }
  </code></pre>
  
  <p>When I create a node that has descendants, I have the reference to the node and also the son has a reference to the node in the Parent property. Also, the node has a reference to the descendant in the list of descendants.</p>
  
  <p>So an example.</p>
  
  <pre><code>Node myNode = new Node();
  Node myDescendant = new Node();
  myNode.Descendants.Add(myDescendant);
  myDescendant.Parent = myNode;
  </code></pre>
  
  <p>I can delete the reference to <code>myNode</code> setting it to <code>null</code>. However, the object is still referenced because <code>myDescendant</code> references to it in the <code>Parent</code> property. The <code>myDescendant</code> object is not recollected because is referenced in the descendants list of the node object.</p>
  
  <p>So it seems that there are a cycle that avoid the node recollection. Is this true? Perhaps I need to set to <code>null</code> all the properties in the node and in the descendants and clear the list of descendants?</p>
  
  <p>Thanks so much.</p>