Create separate function for reinit #42
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Robert,
To prevent extra memory from being used when running minimap2, I set
reinit: true. This possibly occurs with other tools, but minimap2 was using extra memory in my case (determined by looking though heap snapshots with chrome dev tools before and after minimap2 was run). After settingreinit: true, there would no longer be a memory leak. However, I noticed that if I enabled it, then I wouldn't be able to get a heap snapshot that accurately measured the peak memory being used by the tool (I would run the heap snapshot after the tool finished since the heap snapshot would be stuck at "Snapshotting..." when trying to snapshot in the middle of the tool execution), since the tool would already be reinitialized. As a solution, I moved the reinit code to a separate function, where the user could call it manually as well (instead of the tool automatically cleaning up). Nevertheless, if reinit is set to true in the config, the original behavior is unchanged and it still will be automatically called.Thank you!
Daniel