您的位置:首页 > 编程语言 > MATLAB

matlab扩大虚拟内存

2015-11-16 15:11 357 查看
deeplearning toolbox的example跑minist手写字库出现爆内存的错误,找到一个扩大虚拟内存的方法。

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

1)查看当前的虚拟内存

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

[plain] view
plaincopy

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)

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

Physical Memory (RAM):

In Use: 1355 MB (54be5000)

Free: 1661 MB (67df7000)

Total: 3017 MB (bc9dc000)

Page File (Swap space):

In Use: 2931 MB (b73af000)

Free: 3126 MB (c3650000)

Total: 6057 MB (17a9ff000)

Virtual Memory (Address Space):

In Use: 755 MB (2f36c000)

Free: 2316 MB (90c74000)

Total: 3071 MB (bffe0000)

Largest Contiguous Free Blocks:

1. [at 7fff0000] 1023 MB (3ff8a000)

2. [at 2bcb0000] 579 MB (24340000)

3. [at 50000000] 428 MB (1ac00000)

4. [at 6ac16000] 83 MB ( 53ea000)

5. [at 284f0000] 47 MB ( 2fc0000)

6. [at 77ce1000] 22 MB ( 167f000)

7. [at 7c43b000] 14 MB ( ea5000)

8. [at 7f7f0000] 7 MB ( 7f0000)

9. [at 711bb000] 6 MB ( 665000)

10. [at 7be74000] 5 MB ( 51c000)

======= ==========

2219 MB (8ab09000)

ns =

1.0733e+09

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

参考文章:/article/5918320.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: