Performance monitoring

I’m experiencing frame drops in my game, probably due to not freeing some resources...

Are there any other monitoring tools besides Meter?
const meter = new Meter(stage, TOP, LEFT);

I’m looking for something that can easily count all the entities on the stage or something similar.

There is the Chrome Dev Panel for MEMORY then take a snapshot and sort reverse alphabetically - it helps to import ZIM_test which is the docs version so you get object names that make sense.

We did a bunch of memory testing in ZIM TEN and used it a lot - pain in the neck - but eventually, we tracked down as much as we could when testing dispose() on all of our objects.

There might be other reasons too - please see

1 Like

Indeed i used the Chrome dev tools - which helped me identify that a container with many sprites (disposed and created many times) wasn't properly cleaned and disposed

this wasn't enough:

this.layer.removeAllChildren();
this.layer.disposeAllChildren();

So I now manually iterate over each child in the layer, remove listeners, stop animation etc.

This fixed it - back to 60 FPS and fixed memory size :slight_smile:

That is good and bad. One thing - do the disposeAllChildren() - DO NOT removeAllChildren() then disposeAllChildren() as the children are then removed before they can be disposed. So can you try again with that in mind and let us know.

I say good an bad, that you found a solution - but bad if our dispose is not working. Also, you may need to set your outside variables to null - we have no control over whether you are still holding objects in variables.

I can confirm that using only:
this.layer.disposeAllChildren();

Does the job :+1:

I thought that calling:
this.layer.removeAllChildren();
Will remove them from the display / render tree only, and that they are still available for disposal...

I assume that dispose takes care of:

  1. removing event listeners
  2. Stopping animations (if it is a sprite)

Okay - excellent. Yes - disposeAllChildren() will remove the child and dispose() the child.