Memory leak of Crowd navigation

Hi there,
when i use reacastJSPlugin of BABYLON, it costs a large memory footprint. And after applying to the mobile device, my phone can not open the page.
So I check the playground demo, and below is the memory footprint case. It is about 930KB.


I’ve just tried with Edge, and I get a reasonable memory footprint compared to 2 other simple playgrounds

image

About 200Mb for the navmesh playground or the default one. Did you do something specific to get that number? Did you interact with the navigation playground?

EDIT: I’ve just tried on my Android phone without issue.

I did not interact with the scene. And for this playground demo, the only thing is initiating the plugin.


It is about 860Mb and can not apply to mobile phones for long term using.
And could you test this demo. it is to navigate on a mesh inspired by PatrolJS for ThreeJS.

About 38Mb for navigation. Is there any way to fix this memory footprint using?

If you open a tab with Babylon.js Playground (babylonjs.com) what is the footprint?
I’d be happy to fix that, I just need to know how it happens.


This small scene is about 215Mb.

Any tool or howto to detect how this huge footprint happens @sebavan ?

I looked a bit more and I can experience the same, the basic scene https://playground.babylonjs.com/#X5XCVT#649 is:

image

The one with recast initialized https://playground.babylonjs.com/#X5XCVT#645 is:

image

From the memory tools in chrome the snapshot shows that all of the overhead is the actual HEAP of the recast plugin. It probably means it is initialized like this:

1 Like

I’ll check the build to see the amount of pre-allocated memory.

2 Likes

Plz let me know if there is any progress. Thanks :smiley:

2 Likes

Should I open an issue on Github for this?

Yes please !

FYI @Cedric Memory leak of Crowd navigation · Issue #13595 · BabylonJS/Babylon.js · GitHub We could probably start with smaller footprint and dynamic memory or is it too slow ?

I’ve checked the build and the allocated size parameter is 64Mb

so, I think it’s a bit more complex than changing the build options. 1st thing to do is to try to repro in a new project.

1 Like

There is a fix ! update recast.js with lower memory usage by CedricGuillemet · Pull Request #13609 · BabylonJS/Babylon.js · GitHub

1 Like

That’s so great! Thanks for your updating.