Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Suggestion / Idea  Per-frame GC Allocation in ObiPathSmoother.Decimate
#1
I am currently profiling my game, which uses ObiRope, in search of what appears to be a memory leak. I don't know yet whether it comes from Obi's Burst solver or not, but I assume so since it only appeared since using it and I will share details on that shall I find out more.

In any event, I noticed some sources of GC allocations that happen every frame and shouldn't be necessary. One has already been reported here and it affects ropes too: http://obi.virtualmethodstudio.com/forum...-3072.html

Another one is the bit array in ObiPathSmoother.Decimate. This can easily be eliminated by making it a member of the class and replace its construction with

Code:
decimateBitArray.Length = Mathf.Max(decimateBitArray.Length, input.Count);
decimateBitArray.SetAll(true);

The loop at the end of the function must then be changed to run only up to input.Count rather than bitArray.Count.

It'd be nice to see this incorporated in a future update. Sonrisa
Reply


Messages In This Thread
Per-frame GC Allocation in ObiPathSmoother.Decimate - by pdinklag - 28-12-2021, 09:12 AM