Yes, we got the memory related issue in R2016b too!
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?
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!