Skip to content

Memory Leak in Interactive Plot #8

@akimbler

Description

@akimbler

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions