MATLAB Answers


Why am I getting inconsistent reports between FEATURE MEMSTATS and MEMORY in MATLAB 7.6 (R2008a)?

The following Tech Note seems to indicate that a matrix can be as large as the "Maximum Free Contiguous Block Size" reported by executing the 'feature memstats'command in MATLAB:
However, this command resulted in the following output on my 64-bit Windows Server 2003 machine:
Physical Memory (RAM):
In Use: 1596 MB ( 63ce2000)
Free: 31002 MB ( 791a63000)
Total: 32599 MB ( 7f5745000)
Page File (Swap space):
In Use: 1870 MB ( 74eaa000)
Free: 33887 MB ( 845fc5000)
Total: 35758 MB ( 8bae6f000)
Virtual Memory (Address Space):
In Use: 928 MB ( 3a041000)
Free: 8387679 MB (7ffc5f9f000)
Total: 8388607 MB (7fffffe0000)
Largest Contiguous Free Blocks:
1. [at 180401000] 8379758 MB (7fdd6e4f000)
2. [at 7fff0000] 3072 MB ( c0010000)
ans =
However, executing the following command:
A = zeros(2^40,1,'uint8');
results in an "Out of Memory" error.
Further, executing MEMORY results in the following output:
Maximum possible array: 33885 MB (3.553e+010 bytes) *
Memory available for all arrays: 33885 MB (3.553e+010 bytes) *
Memory used by MATLAB: 331 MB (3.474e+008 bytes)
Physical Memory (RAM): 32599 MB (3.418e+010 bytes)




1 Answer

Answer by MathWorks Support Team on 27 Jun 2009
 Accepted Answer

The use of FEATURE MEMSTATS to estimate the largest block of contiguous memory is limited to 32-bit Windows platforms as described in the tech note,
On 64-bit platforms, the commands FEATURE MEMSTATS and MEMORY return differing interpretations of available memory.
Executing the following command:
feature memstats
reports the largest memory address block available on the system. This number is in terms of the available memory addresses based on the theoretical limit/process Limit of the architecture (i.e. 32-bit Windows or 64-bit Windows) and not the physical resources that are available.


Sign in to comment.