Comment by smasher164
6 hours ago
Is there a reason you didn't go with something like Boehm for a library gc, instead of writing your reference counting implementation?
6 hours ago
Is there a reason you didn't go with something like Boehm for a library gc, instead of writing your reference counting implementation?
Mainly did it for learning, as dgellow correctly presumed, but also there’s something intrinsically beautiful in writing code with zero dependencies
Learning, I presume?
Also refcounting is not a very difficult thing to implement
I guess I interpreted this part of their README as implying that the author found RC too fragile
> Reference counting buys correctness and composability, but at a cost.
> Disadvantage #1: you must balance every reference. Each value_create, value_retain, and each operation's implicit retain of its operands has to be matched by a value_release. Forget one and you leak; do one too many and you free memory that is still in use. The training examples in examples/ are verbose precisely because they are scrupulous about this in their error paths; that verbosity is the price of leak-free C.
1 reply →