- Home /
DOTS Jobs memory leak and game freezing
Hi all,
I just finished converting quite a large chunk of my code to DOTS jobs instead of the old threading system. I must be getting a memory leak, because on the second frame of runtime my game completely freezes. Unfortunately I can't find any way to debug this as the program complete freezes up. Does anyone know ways to debug this to see what's causing it to freeze?
Thanks!
EDIT: Most of the lag seems to be caused by GC.Collect. I'm not sure why the garbage collector is taking so long, has anyone run into this problem when using JobHandle.CompleteAll?
Answer by andrew-lukasik · May 17, 2021 at 10:04 AM
This GC.Collect
points to managed memory being involved in this problem - not the native one. So imo this problem occurs in-between the jobs, somewhere on the main application thread, when you're processing job results or scheduling new ones.
PS: native memory leaks won't freeze the application, they will crash it instead (parts of operating system in some cases as well).