facebook / memlab

A framework for finding JavaScript memory leaks and analyzing heap snapshots

Home Page:https://facebook.github.io/memlab/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clarify the documentation about measure mode

mrdulin opened this issue · comments

After reading the memlab measure documentation ten times, I still don't know what it is.

So I read the source code of MeasureMode.ts file.

Does that mean if run the scenario in measure mode, memlab will not:

  • Take screenshots
  • Take heap snapshots
  • Extra wait for Target (which I also don't know what it means.)
  • Extra target operations (it seems it is equivalent to the --skip-extra-ops option, which documentation is not clear either)

When I run in measure mode, it seems memlab will run the scenario 10 times.

$ npx memlab measure --scenario tests/detached-DOM-elements/index.js
page-load[1.8MB](baseline)[s1] > action-on-page[2.1MB](target)[s2] > revert[2.3MB](final)[s3]

total time: 46.7s
page-load[1.8MB](baseline)[s1] > action-on-page[2.1MB](target)[s2] > revert[2.3MB](final)[s3]

total time: 46.5s
page-load[1.8MB](baseline)[s1] > action-on-page[2.1MB](target)[s2] > revert[2.3MB](final)[s3]

total time: 46.6s
page-load[1.8MB](baseline)[s1] > action-on-page[2.1MB](target)[s2] > revert[2.3MB](final)[s3]

total time: 46.6s
page-load[1.8MB](baseline)[s1] > action-on-page[2.1MB](target)[s2] > revert[2.3MB](final)[s3]

total time: 46.5s
page-load[1.8MB](baseline)[s1] > action-on-page[2.1MB](target)[s2] > revert[2.3MB](final)[s3]

total time: 46.6s
page-load[1.8MB](baseline)[s1] > action-on-page[2.1MB](target)[s2] > revert[2.3MB](final)[s3]

total time: 46.5s
page-load[1.8MB](baseline)[s1] > action-on-page[2.1MB](target)[s2] > revert[2.3MB](final)[s3]

total time: 46.5s
page-load[1.8MB](baseline)[s1] > action-on-page[2.1MB](target)[s2] > revert[2.3MB](final)[s3]

total time: 46.6s
page-load[1.8MB](baseline)[s1] > action-on-page[2.1MB](target)[s2] > revert[2.3MB](final)[s3]

total time: 46.6s

Please clarify the documentation, what's the measure mode and what are the usage scenarios for the measure mode?

In some web apps, the heap size can show considerable variability across various runs. This fluctuation can often make it hard to understand the impact of memory leaks. The introduction of the measure mode aims to address this challenge by executing the same scenario repetitively, therefore getting multiple data points of JavaScript heap sizes. This can help understand if the heap size movements during specific runs come from memory-related issues or just noises.

@JacksonGL It's helpful. These explanations should be added to the documentation. If there is an example, that's better. Please consider it. Besides, can you open the GitHub repo discussion so we can ask questions there? Leave the GitHub issues for bug reports or feature requests.

Those are good feedback, thanks. The GitHub repo discussion is now open.