MATLAB out of memory

转自:http://www.cnblogs.com/bovine/archive/2011/10/11/2206876.html

运行LTE仿真平台的时候遇到out of memory的问题,上网学习了一会,找到了一些解决方法,这里总结一下。

Out of memory的产生,总的来说,是由于程序运行过程中不断对内存进行读写,造成连续的内存段变少。这里主要学习一些非程序改进的方法,通过对系统的设置解决这个问题。

1.  如何在MATLAB中查看可用内存?

在MATLAB的command window中输入feature ('memstats'),可以得到如下的结果:

?
     Physical Memory (RAM):
         In Use:                             1499 MB (5dba0000)
         Free:                               1571 MB (6237e000)
         Total:                              3071 MB (bff1e000)
     Page File (Swap space):
         In Use:                             1694 MB (69e67000)
         Free:                               4446 MB (115e1e000)
         Total:                              6140 MB (17fc85000)
     Virtual Memory (Address Space):
         In Use:                              633 MB (279fe000)
         Free:                               1413 MB (585e2000)
         Total:                              2047 MB (7ffe0000)
     Largest Contiguous Free Blocks:
          1. [at 22cb0000]                   1239 MB (4d750000)
          2. [at 7da16000]                     28 MB ( 1cda000)
          3. [at 70856000]                     17 MB ( 112a000)
          4. [at 77281000]                     16 MB ( 107f000)
          5. [at 7f7f0000]                      6 MB (  68f000)
          6. [at 7ae71000]                      6 MB (  60f000)
          7. [at 7cd15000]                      5 MB (  5eb000)
          8. [at 7409e000]                      5 MB (  5d2000)
          9. [at 72b63000]                      5 MB (  53d000)
         10. [at 71ab3000]                      4 MB (  4fd000)
                                             ======= ==========
                                             1336 MB (53868000)
  
ans =
  
   1.2995e+009

可以看见虚拟内存只有2G,还有提升空间。考虑提升虚拟内存的方法。

2. 如何提升虚拟内存?系统虚拟内存的提升是否意味着matlab虚拟内存的提升?

方法一:利用win7本身设置。计算机右键→属性→高级系统设置→高级→设置→高级→更改→取消自动管理→自定义大小

方法二:用下面方法可使win7 32位OS下用于matlab的虚拟内存增加到3G。
设置: 开始---所有程序---附件,右击命令提示符,选择“以管理员身份运行”,
输入:bcdedit /set IncreaseUserVa 3072 回车,重启电脑。
取消: 开始---所有程序---附件,右击命令提示符,选择“以管理员身份运行”,
输入:bcdedit /deletevalue IncreaseUserVa 回车,重启电脑。

?
     Physical Memory (RAM):
         In Use:                             1488 MB (5d082000)
         Free:                               1582 MB (62e9c000)
         Total:                              3071 MB (bff1e000)
     Page File (Swap space):
         In Use:                             1652 MB (6742b000)
         Free:                               4488 MB (11885a000)
         Total:                              6140 MB (17fc85000)
     Virtual Memory (Address Space):
         In Use:                             1183 MB (49f0a000)
         Free:                               1888 MB (760d6000)
         Total:                              3071 MB (bffe0000)
     Largest Contiguous Free Blocks:
          1. [at 7fff0000]                   1022 MB (3fe8f000)
          2. [at 476d1000]                    604 MB (25c8f000)
          3. [at 6d366000]                     46 MB ( 2eba000)
          4. [at 70f53000]                     30 MB ( 1e0d000)
          5. [at 7dfd6000]                     23 MB ( 171a000)
          6. [at 45d90000]                     19 MB ( 1350000)
          7. [at 70226000]                     11 MB (  bfa000)
          8. [at 72de4000]                      8 MB (  8ec000)
          9. [at 23100000]                      8 MB (  800000)
         10. [at 7f7f0000]                      7 MB (  7f0000)
                                             ======= ==========
                                             1783 MB (6f725000)
  
ans =
  
   1.0722e+009

可以看到利用上述方法可以使得matlab虚拟内存增加,经过这番调整后,原仿真程序得以运行。

你可能感兴趣的:(c,command,File,OS,matlab,平台)