Hacker News new | ask | show | jobs
by tcfhgj 53 days ago
if the arc is the last: the data structure is destructed and deallocated + atomic check

if the arch is not the last: atomic check

1 comments

You might lose 100 ns or 300 ms. When? Nobody knows. You lose nothing when going out of scope with GC.
as a programmer you know and you can even control it by designing the appropriate scope and moving between scopes

> You lose nothing when going out of scope with GC.

actually, you don't know

Yes, I can, e.g. by implementing deferred deallocation, which is a primitive GC form.

> actually, you don't know

I know because I’ve verified it.

> Yes, I can, e.g. by implementing deferred deallocation, which is a primitive GC form.

sounds more like a form of manual memory management

Manual management involves an explicit function call. Functions called by a destructor are considered automatic.
How does this relate?