Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug / Crash  Memory leak warning with GPU compute solver
#2
(02-05-2025, 02:25 AM)Softscale Wrote: 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.

Hi!

I'm unable to reproduce this issue, neither the editor warnings nor the build crashing on exit.

All these buffers you're disposing of in OnDestroy() are already being disposed of in ObiNativeList.cs. In ComputeColliderWorld.cs, you'll see the buffers are created by calls to AsComputeBuffer() on multiple ObiNativeList instances. This creates the buffer, to which the list holds a reference. Once the lists are disposed in ObiColliderWorld.Destroy(), their respective graphics buffers are disposed of as well.

Judging by the stack trace, the call that should dispose of the graphics buffer is failing with an invalid address access. As mentioned I'm unable to reproduce this, would it be possible for you to send a project that exhibits this issue to support(at)virtualmethodstudio.com so that I can take a closer look?

kind regards,
Reply


Messages In This Thread
RE: Memory leak warning with GPU compute solver - by josemendez - 02-05-2025, 07:35 AM