Memory leaks with angular application

Hi,
I am using babylonJS in an angular project. In a Component, I am having the 3d models. At very first time, when I am visiting that component, It is working properly, performance is so good. If I change the component and come back to the Component which is having webGL, then the frames drop is happening, performance is so poor. If I continuously switch component, then the application gets crashed. If I refresh it manually in the browser, then the performance is again being good. Since this is an angular application. I couldn’t force to refresh it. How to solve this?

It’s almost impossible for us to know the reason for that, but my assumption would be that you are not stopping the render loop, but you add more and more every time the page is shown.

Make sur eyou dispose everything when leaving, or make sure to not recreate the engine/scene/resources when coming back (if you don’t dispose them).

1 Like

Why should I dispose them individually? If I dispose the engine only, then everything will be disposed, Am I right?

disposing the engine should be enough, of course. But it does seem like it doesn’t dispose, otherwise the performance will not be reduced every time you are leaving and coming back.

Having said that, without code, reproduction, demo, it is impossible to know. This is an assumption.

Run a profiler, see what functions are taking most of the cpu cycles, and you will have your answer.

1 Like

Hello @jayakannan just checking in, was your question answered?

1 Like

Partially fixed. not yet completed. As a temporary solution, I am refreshing by forcing the application using javascript.