Navigation using a lot of memory

image

I’m not exactly sure what is causing my game to use up so much memory for navigation. As you can see, it’s using 2645MB, and can go up to 3000MB.

Edit: It went up to ~6kMB

Here’s what I have used in the game, maybe someone else has experienced this before?

• I am using the new PathfindingModifier on some anchored parts in workspace.
• There are lots of dynamic moving and tweening anchored non-collide parts.
• PathAgent’s WaypointSpacing is mostly math.huge, so it uses inflection points.
• My world has ~11k parts, mostly anchored.

Any insight would be helpful, thanks in advance.
~Khronos

This is what I do with many connections:

  • Are they being disconnected?
  • Are tweens when completed being destroyed?

Also, it may have to do with the many parts in the world, you may want to avoid having them load in all at once using StreamingEnabled.

How often do you pathfind? How far are you pathfinding? About how many modifiers do your pathfinding operations include? These are all things to consider, and each of these would increase the load significantly. To combat this, I would maybe cut down on complexity or rate at which you pathfind.

Also, considering that there are lots of dynamic parts. This probably causes pathfinding service to be CONSTANTLY recalculating the path of your object. (I am assuming you recompute the path when you detect it is blocked). But this sounds like something to look into also.

^^^

Pathfinding is fairly expensive on its own so it would be helpful if you provided more details about how you’re incorporating pathfinding into your experience besides just using PathfindingModifiers. Pathfinding being expensive has been a common complaint amongst developers.

4 Likes

After a long debug and testing. I discover that the factors seems to be that when I used TweenService on a very large part (Anchored=true, Cancollide=false) to tween it’s CFrame and Size, it may have triggered the navmesh to update at the rate of TweenService.

I switched to a for loop with a step size of 0.1s and the memory usage was significantly reduced, but still at the 600MB range.

But I am uncertain because I think the navmesh would probably be optimized to not update every heartbeat so maybe they are just correlated.

If anyone has different findings please let me know.

Edit:
I’ve also tried having a PathModifier in the part with PassThrough=true and it didn’t make a difference.

1 Like