• matlab 扩大虚拟内存


    今天服务器挂了。。用了自己电脑结果爆内存,分享一个扩大虚拟内存的方法,经测试有效。。

    使用Matlab生成很大的图片时,碰到了"out of memory"的错误,导致图片无法生成,于是不得不扩展虚拟内存。具体过程记录如下:

    1)查看当前的虚拟内存

        在Matlab的命令行中,键入命令:feature ('memstats'),得到如下结果:

    [plain] view plaincopy
     
     
    1. Physical Memory (RAM):  
    2.     In Use:                             1499 MB (5dba0000)  
    3.     Free:                               1571 MB (6237e000)  
    4.     Total:                              3071 MB (bff1e000)  
    5. Page File (Swap space):  
    6.     In Use:                             1694 MB (69e67000)  
    7.     Free:                               4446 MB (115e1e000)  
    8.     Total:                              6140 MB (17fc85000)  
    9. Virtual Memory (Address Space):  
    10.     In Use:                              633 MB (279fe000)  
    11.     Free:                               1413 MB (585e2000)  
    12.     Total:                              2047 MB (7ffe0000)  
    13. Largest Contiguous Free Blocks:  
    14.      1. [at 22cb0000]                   1239 MB (4d750000)  
    15.      2. [at 7da16000]                     28 MB ( 1cda000)  
    16.      3. [at 70856000]                     17 MB ( 112a000)  
    17.      4. [at 77281000]                     16 MB ( 107f000)  
    18.      5. [at 7f7f0000]                      6 MB (  68f000)  
    19.      6. [at 7ae71000]                      6 MB (  60f000)  
    20.      7. [at 7cd15000]                      5 MB (  5eb000)  
    21.      8. [at 7409e000]                      5 MB (  5d2000)  
    22.      9. [at 72b63000]                      5 MB (  53d000)  
    23.     10. [at 71ab3000]                      4 MB (  4fd000)  
    24.                                         ======= ==========  
    25.                                         1336 MB (53868000)  
    26.  class="line number29 index28 alt2"> </div>  


        结果中显示的虚拟内存为Virtual Memory=2047MB;

    2)增加虚拟内存

        下面方法可使win7 32位OS下用于matlab的虚拟内存增加到3G。

        设置: 开始---所有程序---附件,右击命令提示符,选择“以管理员身份运行”, 
        输入:bcdedit /set IncreaseUserVa 3072 回车,重启电脑。 
        取消: 开始---所有程序---附件,右击命令提示符,选择“以管理员身份运行”, 
        输入:bcdedit /deletevalue IncreaseUserVa 回车,重启电脑。

       ( 注:bcdedit是NT60系列操作系统(Windows 7/Vista/2008)中的一个命令行工具,用于建立和重新配置bootloader。上面命令作用允许用户的程序使用最大3G内存,而win7 32能识别的就是3G,所以,试图将3072改成更大值在32位系统中是徒劳的!)

    3)查看结果

    [plain] view plaincopy
     
     
    1.  Physical Memory (RAM):  
    2.      In Use:                             1355 MB (54be5000)  
    3.      Free:                               1661 MB (67df7000)  
    4.      Total:                              3017 MB (bc9dc000)  
    5.  Page File (Swap space):  
    6.      In Use:                             2931 MB (b73af000)  
    7.      Free:                               3126 MB (c3650000)  
    8.      Total:                              6057 MB (17a9ff000)  
    9.  Virtual Memory (Address Space):  
    10.      In Use:                              755 MB (2f36c000)  
    11.      Free:                               2316 MB (90c74000)  
    12.      Total:                              3071 MB (bffe0000)  
    13.  Largest Contiguous Free Blocks:  
    14.       1. [at 7fff0000]                   1023 MB (3ff8a000)  
    15.       2. [at 2bcb0000]                    579 MB (24340000)  
    16.       3. [at 50000000]                    428 MB (1ac00000)  
    17.       4. [at 6ac16000]                     83 MB ( 53ea000)  
    18.       5. [at 284f0000]                     47 MB ( 2fc0000)  
    19.       6. [at 77ce1000]                     22 MB ( 167f000)  
    20.       7. [at 7c43b000]                     14 MB (  ea5000)  
    21.       8. [at 7f7f0000]                      7 MB (  7f0000)  
    22.       9. [at 711bb000]                      6 MB (  665000)  
    23.      10. [at 7be74000]                      5 MB (  51c000)  
    24.                                          ======= ==========  
    25.                                          2219 MB (8ab09000)  
    26.   
    27. ns =  
    28.   
    29. 1.0733e+09  

       从结果可以看出,虚拟内存提高到了3071MB,重新运行程序,成功!

    参考文章:http://www.cnblogs.com/bovine/archive/2011/10/11/2206876.html 

    from: http://blog.csdn.net/abcjennifer/article/details/43193865

  • 相关阅读:
    hdu3487 Play with Chain
    poj3481
    [HNOI2002]营业额统计
    poj3468 A Simple Problem with Integers
    [NOI2004]郁闷的出纳员
    UVa1308 LA2572
    20130620
    poj3580
    20130618
    C++类模版学习笔记
  • 原文地址:https://www.cnblogs.com/GarfieldEr007/p/5354597.html
Copyright © 2020-2023  润新知