Sample code or projects using a simple check counter in C

I am wondering how difficult it would be to integrate the reference counting mode (or other managed memory) to manage some of my structural libraries in C. What code example would you recommend what I look at?

+4
source share
3 answers

This garbage collector is widely used for C (even in gcc)

+2
source

Python uses RC-based garbage collection and also solves a circular reference problem (i.e. when you have two or more objects that reference each other but no one references them, in this case the reference count will be> 0, but the whole cycle can be assembled).

+2
source

XMLRPC-c and json-c are examples of C libraries that use reference counting (and have slightly different approaches to when they grow them behind the scenes). If you work in a multi-threaded environment, you might also be interested in using kref in the Linux kernel.

+2
source

All Articles