Parfor memory getting lost

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 件のコメント

Matt J
Matt J 2017 年 12 月 4 日
編集済み: Matt J 2017 年 12 月 4 日
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 2017 年 12 月 4 日
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).

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeParallel for-Loops (parfor) についてさらに検索

タグ

質問済み:

2017 年 12 月 4 日

コメント済み:

2017 年 12 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by