Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@daniel-ji
Copy link
Contributor

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 setting reinit: 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

Copy link
Member

@robertaboukhalil robertaboukhalil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just a few changes

src/worker.js Outdated
// =========================================================================
// Reinitialize a tool
// =========================================================================
async _reinit(tool) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this function is meant to be exposed, let's call it reinit without an underscore. Can you also move this block to line 273, just to keep the exposed functions co-located in the code?

@daniel-ji
Copy link
Contributor Author

Updated!

Copy link
Member

@robertaboukhalil robertaboukhalil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@robertaboukhalil robertaboukhalil merged commit c1cadd5 into biowasm:main Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants