Hacker News new | ask | show | jobs
by jheriko 4575 days ago
i consider it dangerous because it requires more manual (and error-prone) work than just doing allocations/deallocations yourself.

i can see the theoretical justification but I am yet to use a system where:

* i do not need to decrement ref counts manually in various situations or by default

* i do not get memory leaks resulting from the above ambiguity

* its easy to debug a leak (because I need to hunt for the right place to decrement the reference count, not just slap it in wherever i want)

coupled with the performance overhead of refcounting i see no benefit to it in practice - as nice as the theoretical idea is. this could be personal experience though - i can easily say that i've had more memory leaks from not understanding a ref counted library than when i manage my own memory - but that might not be the general case.

1 comments

yeah, the problem with these kinds of discussions is that each of us has had their opinion coloured by their different experiences of software.

Overall, my experience of ref counting as implemented by the Apple frameworks has been very positive indeed.

My experience of ref counting in other contexts/frameworks has been patchy, usually depending upon the quality of the developers responsible for it.

The thing I really do like about ref counting is that it is deterministic, unlike other approaches, ie garbage collection.