close
The reference count tracks how many references to the object are currently active. 
When the number of references drops to zero, the object deletes itself. 
The last part is worth repeating: The object deletes itself; the program never explicitly deletes the object.
 

Here are the rules for reference counting:

 0. When the object is first created, its reference count is 1. At this point, the program has a single pointer to the object.
   1. Attach a counter to each pair in memory.
   2. When a new pointer is connected to that pair, increment the counter.
   3. When a pointer is removed, decrement the counter.
   4. Any cell with 0 counter is garbage. 
 

 ref : http://msdn.microsoft.com/en-us/library/ff485846(v=vs.85).aspx

ref : http://berelent.blogspot.com/2010/10/reference-counting.html

arrow
arrow
    全站熱搜

    JerryCheng 發表在 痞客邦 留言(0) 人氣()