title: How are reference types cleared from memory?
body: <p>As objects are reference types they are stored in the heap and primitive data types are store on the stack. </p>
  
  <p>But an object is a collection of primitive datatypes as well reference type i.e. a object may have a integer data member and/or may have another object within it.</p>
  
  <p>When the scope ends the primitive data memory is released from the stack but the heap memory is handled by the garbage collector.</p>
  
  <p>Now my question is: if an object also has a primitive data member then when are they removed?</p>