Possible memory leak with "matfile"? (R2016b)
조회 수: 1 (최근 30일)
이전 댓글 표시
I'm running a code where the results I am generating are saved to disk using matfile. It is running on matlab R2016b on a Linux system. I initially (before running the code) created a v7.3 .mat file that contained variables for all of my results, and each variable is filled with just zeros. At the start of the code I then used the "matfile" command to make a "matOBJ" of this .mat file, and am filling in results as they are generated (the code I am running involves looping over several different locations and generating a result for each location).
Since I have started running the code, the "top" and "free" commands (this is on a linux system) have show a gradual increase in total system memory. There is no one else using the system for anything, so I have to believe that matlab is the culprit.
Running "top" seems to indicate that matlab should only be using ~6-8 GB. When I started, non-matlab stuff was using about 5 GB of RAM, so I would expect total memory usage to remain at a constant ~11-13 GB (this system has 32 GB available). Instead, memory usage has slowly crept up to ~24 GB, and appears to be continuing to rise. In the past I have experienced a similiar issue when using memmapfile, making me think the matfile was the culprit. When this happened with memmapfile, the issue seemed to be that when any part of the mapped file was access, it was loaded into memory and it never was cleared after that part was no longer needed. This type of behavior would explain the gradual increase in memory usage I am seeing.
Has anyone else experienced this issue? Any suggestions on how to avoid it? Anything I need to add to my code when using matfile to ensure that parts I no longer need are cleared from memory?
댓글 수: 1
Pingmin Fenlly Liu
2017년 11월 7일
편집: Pingmin Fenlly Liu
2017년 11월 7일
Yes, we got the memory related issue in R2016b too!
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Performance and Memory에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!