Roll-Call is a process designed by Nicolas Quijano for automatic garbage collection. It can be implemented within high-level compilers, or on top of existing languages such as C (as seen in this demo). The documentation on how it works can be seen here.
The code in this repository is an example of RollCall being implemented on top of C. Please note that the code in this demo is written with readability and simplicity in mind, and thus is not optimized at all. If you wish to see a much more optimized implementation, feel free to look at how it's been re-written for HAM'.
Please note that this code is meant to be compiled and run in 32bit mode
rc_create(type, name, bytes, bool);
- Creates a new variable of type
type
, namename
, and sizebytes
. The boolean controls whether it's ownership can be transfered.
rc_requestOwnership(destination, buffer, type)
- Attempts to transfer ownership of the data in
buffer
todestination
.destination
should be of typetype
. If the data is non-transferrable, a run-time error will occur.
rc_collect()
- Frees all leaked memory. This should be done at the end of a function.
rc_free_all()
- Frees all allocation memory. Should be done at program exit.
- HAM' - My own programming language that uses RollCall as its garbage collector