Parfor memory getting lost

1 view (last 30 days)
Tiko
Tiko on 4 Dec 2017
Commented: Tiko on 4 Dec 2017
I have a while loop in my main function. In each iteration, I call another function where I compute some things within a parfor loop. In order to do its computation, parfor needs a large amount of data. I noticed the amount of used memory increases with time. Parfor doesn't seem to clear the memory after it is finished. I now resolve this by re-starting the parallel pool every few iterations. Is there a better way?
  2 Comments
Matt J
Matt J on 4 Dec 2017
Edited: Matt J on 4 Dec 2017
There's not enough information in your post to be sure that PARFOR is the culprit. Maybe, within the body of the loop, you are calling a particular function that is not clearing its memory.
Tiko
Tiko on 4 Dec 2017
It doesn't happen if I replace parfor by for (but it takes a lot more time, which is why I need the parfor and thus tested a smaller number of iterations). It also does not seem to happen (at least to that extent) in Matlab 2015a (I was using 2015b), but 2015a is a lot slower (I think it penalizes me for writing too many functions and forcing it to copy data between them, but I didn't read what was new between 2015a and 2015b into that much detail).

Sign in to comment.

Answers (0)

Categories

Find more on Parallel for-Loops (parfor) in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!