3 ms·
I use to program in VB6, and it used reference counting. CPhyton still use automatic reference counting (with some trick to break cycles). In both cases, the in
by gus_massa 12y ago
I use to program in VB6, and it used reference counting. CPhyton still use automatic reference counting (with some trick to break cycles). In both cases, the increments and decrements are automatically handled by the compiler. More examples: http://en.wikipedia.org/wiki/Reference_counting#Examples_of_use http://en.wikipedia.org/wiki/Reference_counting#Examples_of_...
Reference counting is not a bad idea until you have to deal with cycles. Once you need to use cycle of references you have to be extremely careful to break it or the code will leak memory. And sometimes, with complex code, the cycles are not obvious. There are some methods to deal with cycles, but all of them are painful.
http://en.wikipedia.org/wiki/Garbage_collection_(computer_science)#Reference_counting http://en.wikipedia.org/wiki/Garbage_collection_(computer_sc...