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 demands of segmentation #1033

Open
arokem opened this issue Sep 18, 2023 · 1 comment
Open

Memory demands of segmentation #1033

arokem opened this issue Sep 18, 2023 · 1 comment

Comments

@arokem
Copy link
Collaborator

arokem commented Sep 18, 2023

Several users have noticed that the segmentation is quite memory demanding. I suspect that it has to do with the initialization of multiple of the _SlsBeingRecognized objects on this line:

https://github.com/yeatmanlab/pyAFQ/blob/master/AFQ/segmentation.py#L569-L572.

A couple of thoughts about potential solutions:

  1. Pass a copy of the streamlines in, instead of the tg.streamlines variable. Here, I am worried about a potential memory leak associated with passing these streamlines by reference, and that it's possible that Python is keeping this reference alive across the repeated initializations.
  2. Spill to disk. In particular, maybe the variables defined on these lines of code: https://github.com/yeatmanlab/pyAFQ/blob/master/AFQ/segmentation.py#L52C1-L54 could use memory maps, instead of being fully held in memory in this way?
  3. Explicit garbage collection at the end of each bundle. This takes a little bit of time, but might help force a clearing of memory, since Python is not very pro-active doing its own garbage collection.

Happy to hear other thoughts/ideas for tackling this.

@36000
Copy link
Collaborator

36000 commented Mar 25, 2024

I haven't noticed this as a big issue anymore? I wonder if it is an issue with our parallelization setup, which is now not the default ( #1030 ) but could still use fixing if it is the problem

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