JSHeap, garbage collector and lags

Hello,

i noticed some lags in my application when i rotate the camera around. So i looked on performance in Chrome and saw this:

That performance report is from rendering basic playground example without any interaction. JSHeap rises and then GC kicks in and removes unused objects, i assume that this is causing lags in my project.

Any idea what is causing this and how to prevent it?
Thanks

L

The JSHeap varries from 24.4MB to 25.5MB, so a 1.1MB heap memory is being cleared once in a while. We do our best to reuse elements and never recreate them (thou it is sometimes impossible). This 1.1MB can come from the browser itself or some other js scripts running in the background (the editor, for example).

Examining a more complex scene (for example) https://playground.babylonjs.com/#3VMTI9#0 will give you the same memory span (ca. 1MB), which is somewhat acceptable.

Also notice the amount of idle time the performance report is showing. There should not be any lag at all. Do you get a lag with the default scene? or with a more complex one? wanna share a screencast? or better yet - a playground?

** EDIT - if you do however find some place where we don’t reuse objects, we will fix it ASAP

3 Likes

Unfortunately i cannot reproduce situation in my app in the playground. However i noticed that when i remove ActionManager from my SPS mesh then it doesn’t lag. There is also no lag when i rotate the scene in such way that the mouse is not over the SPS during rotation. I will investigate further and when i find something then i will try to replicate it in playground.

1 Like