Brett's Pick this week helps you determine if your memory is fragmented, and, more importantly, what steps you might take to minimize 'Out of Memory' errors. Many of you know of Stuart from the MATLAB Central File Exchange; for years, when we tracked these things, he was the most-downloaded author on the Exchange. Those of us who know him as a colleague at The MathWorks know him as well as a guru of sorts for dealing with memory (and out-of-memory) issues.
Suppose you wanted to know the size of the largest variable you could create at any given moment in MATLAB. We know from the documentation for the MEMORY command that the largest possible variable is the smaller of the following two values: a)The largest contiguous memory block found in the MATLAB virtual address space, and b) The total available system memory. (The MEMORY command will return this value in a field called MaxPossibleArrayBytes.) Stuart's file CHKMEM takes MATLAB's memory command and does it one better. CHKMEM compares the largest available variable size to your system's RAM and provides suggestions for decreasing the gap between the two. It also suggests ways to increase the available physical memory. For instance, I had thought that my 3-GB switch was enabled; Stuart's code informed me that, in fact, it is not currently set. And then he provides links to documentation showing how to set it!
Very nice utility, Stuart! Thanks for sharing it.
Comments? Share them here.
댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.