Hacker News new | ask | show | jobs
by rix0r 3622 days ago
Saying "use immutable data structures" here assumes garbage collection though.

If you didn't have garbage collection, when would you release the memory for these structures? That would bring you back to refcounting.

2 comments

Is it a problem in practice to use reference counting for an "immutable data structures" ? Obviously it's not 100% immutable as the counters are updated. But if it's done with a thread safe reference counter the data structures is usable like a pure immutable data structure and doesn't need an additional garbage collector.
Oh, yeah, I missed that bit of context. Oops. OP's comment makes much more sense now...