Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leaks #338

Open
wpmed92 opened this issue Sep 7, 2017 · 5 comments
Open

Memory leaks #338

wpmed92 opened this issue Sep 7, 2017 · 5 comments
Assignees

Comments

@wpmed92
Copy link

wpmed92 commented Sep 7, 2017

Hello!

I really like your library I use it one of my projects. I need really fast garbage collection because they'll use my application in a clinical environment, but the extensive usage of callbacks in your lib results in slow GC, and in some objects not being collected at all. I found that after calling viewer.clearVolumes() the TypedArrays allocated are actually never freed, which results in out of memory error when loading and reloading lot of files. Also in nifti1 the loadFromFile's callback is not always collected (so the arraybuffer 'sticks' in the GC chain). In Mozilla's Dominators view I see it being collected when loading file for the first time. But when I load a file again, the callback stays on the heap and is never collected. (Maybe it would've been collected but once I tested it wasn't collected in like an hour or so). The latter is pretty strange though. I attached screenshots, but you can test it on your machine.

  1. arrayBuffer on heap before GC kicks in gc_debug_1
  2. arrayBuffer collected
    gc_debug_1_freed
  3. a new file loaded (viewer.clearVolumes not freeing up typedarrays and arraybuffer from file loading sticks on heap as well)
    gc_debug_2_not_collected
@rdvincent
Copy link
Collaborator

Thanks for the report. I'll try to look into this.

@rdvincent rdvincent self-assigned this Sep 7, 2017
@wpmed92
Copy link
Author

wpmed92 commented Sep 7, 2017

Thank you. Looks like the ArrayBuffer somehow survives in createNifti1Data? Not sure though.

@wpmed92
Copy link
Author

wpmed92 commented Sep 8, 2017

"But when I load a file again, the callback stays on the heap and is never collected. " this one seems to be firefox specific, not present in chrome. viewer.clearVolumes() bug is present in both

@gregorybolkenstijn
Copy link

I'm having similar issues. Any word about progress on this?

@lblewis
Copy link

lblewis commented Nov 9, 2018

It is my understanding (someone please correct me if I am wrong) that @rdvincent is occupied with other work for the foreseeable future, and @natacha-beck is on maternity leave through the summer. Please chime in if anyone else in working on this...?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants