Possible memory leak with "matfile"? (R2016b)

3 visualizzazioni (ultimi 30 giorni)
Anthony Barone
Anthony Barone il 9 Mar 2017
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 Commento
Pingmin Fenlly Liu
Pingmin Fenlly Liu il 7 Nov 2017
Modificato: Pingmin Fenlly Liu il 7 Nov 2017
Yes, we got the memory related issue in R2016b too!
See also matlab 2016a (linux) memory leak for more info.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Performance and Memory in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by