Matlab doesn't release memory when function finishes
13 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I've checked all documentation I can find to solve my problem and nothing works. Matlab grabs memory and doesn't let it go. Clear doesn't work, pack doesn't help, I've tried clear functions... Basically, once the memory is caught, the only way that I can release it is to quit matlab and start over. I am creating (and closing) large numbers of netcdf files. Processing 250 of these uses only .6% of my memory. Multiply this times 80000 files and you can see the problem. It either causes matlab to crash (the preferred option since I can at least restart it where it left off) or freezes the linux VM causing delays while I try to get it rebooted. I've tried to use a function to perform this task because the end of a function is supposed to release the memory required but I'm still using 5.1% after starting the exercise at 4.5%. I have 2gb of swap and 7gb of usable memory which should be more than sufficient since each file takes only a tiny fraction of this but if it doesn't get released, it just keeps building up until.... Any advice would be gratefully appreciated!
0 Kommentare
Antworten (1)
Image Analyst
am 14 Okt. 2014
Try manually deleting large variables just before you exit from the function with clear().
clear('bigHonkingArray', 'anotherWhopperArray', 'motherOfAllArrays', 'OMGItsHuge');
Siehe auch
Kategorien
Mehr zu Data Import and Export finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!