85
you are viewing a single comment's thread
view the rest of the comments
[-] Mihies@programming.dev 1 points 5 days ago

Welcome GC pauses :) I wonder how do those manifests in real life.

[-] FizzyOrange@programming.dev 4 points 5 days ago

Games might be an area where it isn't too bad since you can disable the GC while doing all your physics and graphics, and then just after you've dispatched a frame trigger a GC with a hard time limit.

I don't know if Unity works like that but it should.

[-] Mihies@programming.dev 1 points 4 days ago

I don't think that's even possible - to have that much control over GC engine that is.

[-] FizzyOrange@programming.dev 1 points 4 days ago
[-] Mihies@programming.dev 1 points 4 days ago

It's not trivial as it seems. See https://github.com/dotnet/runtime/issues/37667 and enhancement that happened only in .NET 8.

[-] FizzyOrange@programming.dev 1 points 4 days ago

Interesting. From the sounds of it Unity added their own API for it though.

[-] PushButton@lemmy.world 2 points 4 days ago

There are plenty of games made with C# and Unity.

You surely played a few of them, let's be honest.

So, if you're asking this question, I guess the answer is: "you don't even realize it's happening"...

Rust marketing; since Rust has became popular, GC became a problem, out of no where, and segfaults became the most terrible bug a software can be afflicted with.

If C# and Unity are working well for them, good for them.

[-] Mihies@programming.dev 1 points 4 days ago

TBH I almost don't play games and I'm genuinely curious whether GC pauses are noticeable. And not only Rust, there is Swift as well.

[-] ZILtoid1991@lemmy.world 1 points 4 days ago

C# uses ref counting, which has much less impact on that. I do however use D for my game engine, which some say is infamous for its GC pauses, but they only happen if you allocate with the GC itself, and otherwise if you work work the GC, you can get some performance gains compared to dumb manual memory management, but not so much if you actually can manage your own memory, or write your own automatic memory management system, like I did on top of numem. Otherwise the pauses are negligible for smaller projects, and some of the larger projects like The Art of Reflection uses GC only for loading assets, with my engine also going in that direction.

[-] Mihies@programming.dev 1 points 4 days ago

Um, no, C# most definitely uses GC, not ref counting, and you can't not use it.

[-] ZILtoid1991@lemmy.world 1 points 4 days ago
[-] Mihies@programming.dev 1 points 4 days ago* (last edited 3 days ago)

I don't think so. Ref counting is a counter associated with the object which counts references to it and when it becomes ~~null~~ 0, object is destroyed. Hence ref counting. While GC does graph traversal to find which objects can be reached and marks unreachable ones as candidates for destroying.

this post was submitted on 29 Apr 2025
85 points (92.9% liked)

Programming

19957 readers
363 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS