this post was submitted on 29 Apr 2025
83 points (92.8% liked)

Programming

19927 readers
176 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 [email protected]



founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 2 days ago (1 children)

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 1 points 2 days ago (1 children)

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

[–] [email protected] 1 points 2 days ago (1 children)
[–] Mihies 1 points 2 days ago* (last edited 1 day 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.