Remix.run Logo
▲ jayd16 4 hours ago

It's only surrendered control if you refuse to understand it and how to control it.

▲generichuman an hour ago | parent | next [-]

The (Tracing) Garbage Collector abstraction isn't really designed to be controlled though. You can understand the implementation and write code against that, but at that point, why not switch to something that you can genuinely control?

I'm not saying manage memory manually. You can switch to a language that is reference counted. Then at least that abstraction guarantees deterministic deallocation.

That comes with another set of trade-offs such as having to pay attention to atomic reference counts, making sure there's no cycles, maybe even treating some graphs as arenas to avoid chained deallocations, but the abstraction itself is designed to be deterministic and is more easily controlled.

▲unrented7977 3 hours ago | parent | prev | next [-]

Exactly. You have a shocking amount of control over the GC if you bother to learn. Surrendering control is a choice the programmer makes by not understanding their tools.

▲lilbigdoot 2 hours ago | parent | prev [-]

There's still limits on that control.

▲unrented7977 an hour ago | parent [-]

You'll need to be a lot more specific, because C# offers you a lot of control. You can, for example, disable GC and run it manually at runtime. You can exempt objects from GC. You can exempt objects from relocation. You have pointers and unsafe contexts. Frankly I can't think of anything you'd want to do with GC that isn't offered already.

One does not have to live with the tradeoffs that C#'s default GC makes. One just needs to understand how the GC works and how it is controlled.