Closed bryanedds closed 6 months ago
Hello, We're currently working on the issues you mentioned.
The problem seems to stem from RcBuilderResult referencing many objects. We're currently working on optimizing RcSpan. Once the issue is resolved, we will mention it.
Thank you kindly!
@bryanedds
50ea674 - used option keepInterResults
to save memory
Inspired by the recastnavigation source code, I added the keepInterResults option. You will be able to see that it significantly reduces memory usage.
I don't think this change set helps us because none of the changes touch our actual use path. Here's how we use DotRecast currently -
We use the public RcBuilderResult Build(IInputGeomProvider geom, RcBuilderConfig bcfg)
method to generate our nav data, which in turn calls public RcBuilderResult Build(RcContext ctx, int tileX, int tileZ, IInputGeomProvider geom, RcConfig cfg, RcHeightfield solid)
. As far as I can see, neither of those code paths are hit any of the code you changed.
Am I missing something?
@bryanedds
9777751 - Added the keepInterResults option to RcBuilder.Build()
fixed!!
Thank you, this should work better!
I'm in the memory profiler today checking in on my program and was surprised by the number of objects that DotRecast is creating and keeping live for what might be considered a relatively small scene -
Here you'll notice we have 500k live instances of RcSpan -
Is there any change we can make to DotRecast or our usage to reduce the object count footprint here? Maybe a different internal representation or perhaps a posteri pruning? Or perhaps there's a reference from the mesh construction process I can let go of? I currently keep a reference to RcBuilderResult so I can draw the above debug lines. Should I not hold on to that? If so, would there be a better way to draw debug info for the nav mesh than using RcBuilderResult? If not, can I prune RcBuilderResult somehow?
Since we're dealing with realtime games, we'd like to keep the GC sweep phase as cheap as possible.
Lastly, here's the related issue I filed locally -
https://github.com/bryanedds/Nu/issues/774
Thank you for your greatly helpful project - it has already saved us tremendous amounts of time and effort!