Hacker News new | ask | show | jobs
by AnimalMuppet 19 days ago
I think I understand you now. You don't do reference counting for something "on the stack" (in C++ terms), you only do it for something on the heap. Things on the stack can have destructors, but that gets called when the stack frame goes out of scope. So anything reference counted, when the count goes to zero, will not only have its destructor run, but will also be deallocated on the heap (calling free).

And then whether you blame that on reference counting or garbage collection or heap allocation is kind of an arbitrary distinction.

OK, I get it. You were right :-)