logoalt Hacker News

toxikyesterday at 5:59 PM1 replyview on HN

Also refcounting is not a very difficult thing to implement


Replies

smasher164yesterday at 6:07 PM

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.

show 1 reply