Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

One other advantage of RC that I don't think you've brought up yet, is that you know exactly when the work to free M objects will take place.


No you don't. If you did you could just call free. You know one of the decrements will do it, but not which one.


Good point.

I was thinking of a lot of cases where RC is being used as a general solution for lifetime management with automatic refcounting; but most objects have a well-known lifetime with their refcount being 1 95% of the time. And another 4% have their refcount bump up to 2 briefly when they're temporarily shared, or transferred to a new owner (think returning a shared_ptr<>).

But, yeah, the "genuinely shared" case - either the 1% in the scenario above, or when RC is only being used for objects with complex lifetimes - is definitely a significant use-case I overlooked.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: