@runevision@mastodon.gamedev.place
Post #2157902
2026-05-07 13:29 UTC
As one might expect from a Unity game, some of my hiccups in framerate are caused by garbage collection. I've recently removed some allocations caused by delegate closures - an issue I was previously unaware of.
However, a bigger problem is that the Parallel.ForEach functionality in .Net I'm using for multithreading seems to allocate too. I don't have the expertise to write my own replacement, haven't seen existing ones, and can't use Unity's job system, so I might not be able to address this.
Replies (3)
-
@portaloffreedom@social.linux.pizza 2026-05-07 13:31
@runevision@mastodon.gamedev.place can you pass it your own memory instead of relying on the standard allocator?
-
@runevision@mastodon.gamedev.place 2026-05-08 16:16
Hmm, it turns out incremental garbage collection was introduced in Unity many years ago but it wasn't enabled in my project. This helps a lot reducing the size of the spikes from garbage collection. Not enough to entirely avoid dipping below 60 fps, but it's a lot less severe than the 100+ ms spikes before.
-
@aras@mastodon.gamedev.place 2026-05-07 13:37
@runevision@mastodon.gamedev.place why you can’t use Unity’s?