Skip to content

Realign4dAlgorithm memleaks? #398

Open
@bpinsard

Description

@bpinsard

I have problems when using Realign4dAlgorithm, especially with large files in the nipype interface.
The memory seems no to be fully cleared then causing memory hog.
I tracked down with mprun down to cython function which seems to be the source.
_cspline_sample4d (3d/2d is certainly the same) to which an output array is given still take memory that is not released afterward.

for example running multiple times resampling (wrapped for memory_profiler to work) with the same value does take some memory (even if it stabilizes after a few). If I change the coordinates it again eat some more of the memory then stabilizes...

In [9]: %mprun -f memleaks.cspline_samp csampl=memleaks.cspline_samp(out,cdata,coords,coords,coords,coords)
Filename: /home/bpinsard/data/tests/memleaks.py

Line #    Mem usage    Increment   Line Contents
================================================
     7    896.8 MiB      0.0 MiB   def cspline_samp(*args):
     8    904.4 MiB      7.6 MiB       nipy.algorithms.registration._registration._cspline_sample4d(*args)
('',)

In [10]: %mprun -f memleaks.cspline_samp csampl=memleaks.cspline_samp(out,cdata,coords,coords,coords,coords)
Filename: /home/bpinsard/data/tests/memleaks.py

Line #    Mem usage    Increment   Line Contents
================================================
     7    904.4 MiB      0.0 MiB   def cspline_samp(*args):
     8    904.5 MiB      0.1 MiB       nipy.algorithms.registration._registration._cspline_sample4d(*args)
('',)

In [11]: %mprun -f memleaks.cspline_samp csampl=memleaks.cspline_samp(out,cdata,coords,coords,coords,coords)
Filename: /home/bpinsard/data/tests/memleaks.py

Line #    Mem usage    Increment   Line Contents
================================================
     7    904.5 MiB      0.0 MiB   def cspline_samp(*args):
     8    904.5 MiB      0.0 MiB       nipy.algorithms.registration._registration._cspline_sample4d(*args)
('',)

@alexis-roche do you have any idea? Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions