Re:Swift is a more convenient Rust
by 112233 on Friday September 06, 2024 @08:47AM
(#41465655)
Deleting large hierarchy of objects when the last reference gets decremented also is triggered by a certain signal (reference decrement) and pauses all threads while it collects garbage. There are even tunable GC that become ARC if you set particular parameter to "N=1"
[ Parent
| on HN ]
I'm not sure that collecting a large hierarchy of objects requires pausing all threads. What can definitely require pausing threads (other than in specialized concurrent collectors) is the tracing step, which relies on some invariants that in simple GC implementations (not the more specialized concurrent ones mentioned earlier) are only ensured at very specific points in the program (known as GC "safepoints").
My bad, thanks for correcting! Of course single thread freeing a lot of heap allocations will not pause other threads by itsel. What I had to write was: calling destructor of an object that in turn calls destructors of other objects (because a large tree of reference counted objects loses last reference to it's root) stops that thread, until all deallocation is done.
Re:Swift is a more convenient Rust
by pessimizer on Friday September 06, 2024 @09:14AM
(#41465893)
> There are even tunable GC that become ARC if you set particular parameter to "N=1"
You can call a pointer to a value a "one-element static array."