Obi Official Forum
Suggestion / Idea Per-frame GC Allocation in ObiPathSmoother.Decimate - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html)
+--- Thread: Suggestion / Idea Per-frame GC Allocation in ObiPathSmoother.Decimate (/thread-3250.html)



Per-frame GC Allocation in ObiPathSmoother.Decimate - pdinklag - 28-12-2021

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/thread-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


RE: Per-frame GC Allocation in ObiPathSmoother.Decimate - josemendez - 12-01-2022

Thanks a lot for the feedback! This will be incorporated into 6.3.1.