logoalt Hacker News

ceteiayesterday at 2:52 PM1 replyview on HN

> A refcounting algorithm, like that found in Rust's (and C++'s) runtime is such a classic GC that not calling it a GC is just confusing.

But is it not easy to opt out of in C, C++, Zig and Rust, by simply not using the types that use reference counting?

And how does your performance analysis consider techniques like arenas and allocating at startup only?


Replies

pronyesterday at 8:37 PM

> But is it not easy to opt out of in C, C++, Zig and Rust, by simply not using the types that use reference counting?

In C, Zig, and C++ sure. In Rust? Not without resorting to unsafe or to architectural changes.

> And how does your performance analysis consider techniques like arenas and allocating at startup only?

Allocating at startup only in itself doesn't say much because you may be allocating internally - or not. Arenas indeed make a big difference and share some performance behaviours with moving-tracing collectors, but they can practically only be used "as god intended" in Zig.