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 Leak in Interactive Plot #8

Open
akimbler opened this issue Sep 7, 2021 · 1 comment
Open

Memory Leak in Interactive Plot #8

akimbler opened this issue Sep 7, 2021 · 1 comment

Comments

@akimbler
Copy link

akimbler commented Sep 7, 2021

I'm not sure where to leave this, as I think it might be on the jupyter-widgets side of things. There's currently a memory leak using interactive plots. If I replot the same code several times, the memory usage climbs about ~500MB.

The code I used to test was a basic interactive plot:

import matplotlib
import nanslice.jupyter as ns
%matplotlib widget
base = ns.Layer("D:\Documents\OneDrive\Desktop\sub-1001_ses-S1_task-rest_run-1_bold.nii.gz", cmap='gist_gray')
stat = ns.Layer("D:\Documents\OneDrive\Desktop\midthal_80th_trans.nii.gz", cmap='turbo_r', clim=(0,1.0), mask_threshold=0.95)
ns.three_plane([base, stat], interactive=True)

VSCode baseline starts at:
image
After the first execution we get:
image
Which climbs to this after second execution:
image

I didn't notice initially as my work machine has 32GB of memory, but this is likely much more apparent to those on older/less high-end

@spinicist
Copy link
Owner

Hello,

Thanks for reporting this. I think we should try to narrow down where the problem might be occurring, as the stack is pretty deep! I don't seem to see the same issue, but I am running on Mac, with standard VS Code (not Insiders), so I have a very different environment.

Does the amount of memory consumption grow linearly with the number of replots? Does it plateau at all? I think VS Code now has some debugging options for Notebooks to see variables and memory usage but I've not used them before - if you know of anything like that can you try investigating a bit please?

Thanks!

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

2 participants