I am wondering how difficult it would be to integrate a reference counting (or other managed memory) regime for managing some of my struct libraries in C. What sample code would you recommend I look at?
+1
A:
Python uses garbage collection based on RC and it also solves the circular reference problem (i.e. when you have two or more objects that reference each other but no one else references them; in this case, the ref count will be > 0 but the whole cycle could be collected).
Aaron Digulla
2009-09-16 15:16:12
+1
A:
XMLRPC-c and json-c are examples of C libraries that use reference counting (and have slightly different approaches as to when to increment them behind the scenes) . If you are in a multi-threaded environment, you might also be interested in the kref usage in the Linux kernel.
tsg
2009-09-16 17:28:29