02-05-2025, 02:25 AM
(Unity 2022.3.61f1, Obi 7.0.5, Windows 10)
Hey there, I've recently been updating my project from Obi 6 to 7, and also switching to use the GPU compute solver. I noticed in the editor after some testing and re-starting play mode, it would pop up 12 warnings with this:
This wasn't a major issue, however I also started to get crashes on the built version of my game when exiting, with the stack trace in the Player.log ending with:
Doing a build with the Development Build flag did not crash on exit but also threw those GarbageCollector warnings.
After some tracing, all of the warnings were coming from ComputeColliderWorld.cs. I added Dispose()s for each of the buffers that were causing problems to the OnDestroy:
This fixed the warnings popping up in editor, and the game no longer crashes on exit in the built version. There may be other buffers that also need to be disposed in this component but these were the ones that were causing issues for my game. Just wanted to let you know about this problem.
Hey there, I've recently been updating my project from Obi 6 to 7, and also switching to use the GPU compute solver. I noticed in the editor after some testing and re-starting play mode, it would pop up 12 warnings with this:
Code:
GarbageCollector disposing of GraphicsBuffer. Please use GraphicsBuffer.Release() or .Dispose() to manually release the buffer.
This wasn't a major issue, however I also started to get crashes on the built version of my game when exiting, with the stack trace in the Player.log ending with:
Code:
ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FFC2836FDFB)
0x00007FFC2836FDFB (UnityPlayer) (function-name not available)
ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FFC27DB3BAE)
0x00007FFC27DB3BAE (UnityPlayer) (function-name not available)
0x00000293A7D6D9DA (Mono JIT Code) (wrapper managed-to-native) UnityEngine.GraphicsBuffer:DestroyBuffer (UnityEngine.GraphicsBuffer)
0x00000293A7D6D8B3 (Mono JIT Code) UnityEngine.GraphicsBuffer:Dispose (bool)
0x00000293A7D6D823 (Mono JIT Code) UnityEngine.GraphicsBuffer:Dispose ()
0x00000293A6AE4D53 (Mono JIT Code) Obi.ObiNativeList`1<Obi.TriangleMeshHeader>:DisposeOfComputeBuffer ()
0x0000029665B30A63 (Mono JIT Code) Obi.ObiNativeList`1<Obi.TriangleMeshHeader>:Dispose (bool)
0x0000029665B309AB (Mono JIT Code) Obi.ObiNativeList`1<Obi.TriangleMeshHeader>:Finalize ()
0x000002937187A18C (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_virtual_void__this__ (object,intptr,intptr,intptr)
0x00007FFC2B156F77 (mono-2.0-bdwgc) mono_callspec_cleanup
0x00007FFC2B158118 (mono-2.0-bdwgc) mono_gc_finalize_notify
0x00007FFC2B158680 (mono-2.0-bdwgc) mono_gc_finalize_notify
0x00007FFC2B0EF9AB (mono-2.0-bdwgc) mono_profiler_init_etw
0x00007FFC2B0EFBBE (mono-2.0-bdwgc) mono_profiler_init_etw
0x00007FFD51F47374 (KERNEL32) BaseThreadInitThunk
0x00007FFD521BCC91 (ntdll) RtlUserThreadStart
Doing a build with the Development Build flag did not crash on exit but also threw those GarbageCollector warnings.
After some tracing, all of the warnings were coming from ComputeColliderWorld.cs. I added Dispose()s for each of the buffers that were causing problems to the OnDestroy:
Code:
transformsBuffer?.Dispose();
aabbsBuffer?.Dispose();
materialsBuffer?.Dispose();
shapesBuffer?.Dispose();
forceZonesBuffer?.Dispose();
rigidbodiesBuffer?.Dispose();
distanceFieldHeaders?.Dispose();
bihNodes?.Dispose();
triangleMeshHeaders?.Dispose();
dfNodes?.Dispose();
triangles?.Dispose();
vertices?.Dispose();
This fixed the warnings popping up in editor, and the game no longer crashes on exit in the built version. There may be other buffers that also need to be disposed in this component but these were the ones that were causing issues for my game. Just wanted to let you know about this problem.