facebook / memlab

A framework for finding JavaScript memory leaks and analyzing heap snapshots
https://facebook.github.io/memlab/
MIT License
4.35k stars 118 forks source link

How do I not save file s1.heapsnapshot, s2.heapsnapshot, s3.heapsnapshot when Run Memlab in Node.js? #54

Closed zlq1997 closed 1 year ago

zlq1997 commented 1 year ago

when I use command "memlab run --scenario /path/to/test/scenario/file.js \ --work-dir /path/to/save/memlab/run/results/", the saved files s1.heapsnapshot, s2.heapsnapshot, s3.heapsnapshot occupy about 300M in local PC, it's too large for me, how can I cancel save them?

JacksonGL commented 1 year ago

MemLab needs those snapshot files to find memory leaks. You can add a --skip-snapshot option when running MemLab, the option is only used for testing the e2e interaction, MemLab won't try to detect memory leaks then.

zlq1997 commented 1 year ago

It means if I don't want to save heapsnapshots, I should delete them manually after the running of MemLab? That is a little tricky!

JacksonGL commented 1 year ago

If you mean MemLab can save heap snapshots for analysis but needs to delete the snapshots after detecting memory leaks, we can add a new flag (e.g., --clean-up-snapshots) to clean up afterwards.

Alternatively, you can use this bash command to clean up the snapshots:

rm -rf $(memlab get-default-work-dir)/data/cur/*.heapsnapshot