各种Matlab运行时out of Memory问题处理方法(全).doc

上传人:新** 文档编号:561931650 上传时间:2023-10-06 格式:DOC 页数:10 大小:71.01KB
返回 下载 相关 举报
各种Matlab运行时out of Memory问题处理方法(全).doc_第1页
第1页 / 共10页
各种Matlab运行时out of Memory问题处理方法(全).doc_第2页
第2页 / 共10页
各种Matlab运行时out of Memory问题处理方法(全).doc_第3页
第3页 / 共10页
各种Matlab运行时out of Memory问题处理方法(全).doc_第4页
第4页 / 共10页
各种Matlab运行时out of Memory问题处理方法(全).doc_第5页
第5页 / 共10页
点击查看更多>>
资源描述

《各种Matlab运行时out of Memory问题处理方法(全).doc》由会员分享,可在线阅读,更多相关《各种Matlab运行时out of Memory问题处理方法(全).doc(10页珍藏版)》请在金锄头文库上搜索。

1、out of Memory问题处理方法简单总结一下:1. 增加虚拟内存2. 采用PACK3. 条件允许的话采用64位系统4. 采用3GB switch5. 优化程序,减少变量6. 如果必有必要,不要启动java虚拟机,采用matlab -no . 直接显示out of memory。我尝试了很多办法,都是无济于事,您上面介绍的几种办法我都试过了,不知道为什么,还是不行。有一篇文章是这么写的,您看看行吗1. 查找matlab根路径.在matlab命令行中敲入:matlabroot 显示根路径,如:C:MATLAB7 2.查看当前Java虚拟机最大堆内存, 敲入:java.lang.Runtime

2、.getRuntime.maxMemory 3.查看Java虚拟机版本.敲入:version -java 4.在 $MATLABbin$ARCH 路径下新建java.opts文件. $MATLAB是根路径,例如C:MATLAB7 $ARCH是系统架构.例如win32,则在C:MATLAB7binwin32下新建java.opts文件. 5.用记事本打开java.opts文件, 对于不同的版本的Java虚拟机,输入: The following table shows the default settings MATLAB uses for versions of the JVM:JVM Ini

3、tial Heap Size Max Heap Size1.6.0 -Xms64m -Xmx128m (32-bit) -Xmx196m (64-bit)1.5.0 -Xms64m -Xmx96m(32-bit) -Xmx128m (64-bit)1.4.2 -Xms16m -Xmx96m1.3.1 -Xms16000000 -Xmx640000001.2.2 -Xms16000000 -Xmx640000001.1.8 -ms16000000 -mx64000000例如我的Java是1.4.2,在java.opts文件写入-Xmx96m,保存就ok啦如果输入错误就报错:warning : F

4、ailed to start to Java Virtual machine6. 重启matlab,敲入java.lang.Runtime.getRuntime.maxMemory 显示最大内存改变,设置成功.使用xlswrite 或者fprintf 将数据写到text或者excel文件中使用PACK:PACK可以将matlab中的变量导出到磁盘中,以增加可用内存。减少变量的内存开销:清除工作间不必要的变量。64位架构:采用64位的软硬件架构,目前实验室条件下不可行。3GB切换(3GB switch):由于在windows上运行matlab时,如果内存的使用超过约1.7G左右就要出现这种错误,

5、而无论你有多大的内存也没用。幸好现在在Windows XP上,MATLAB现在支持3GB切换(3GB switch)启动选项(boot option),配置额外的1GB的可寻址内存到每个程序上。这增加了你可以储存到MATLAB workspace中资料的总量约到2.7 GB。这相当于33亿的精度值。此新增的内存区块和MATLAB使用剩下的(内存)并不是连续的,所以你不能建立一个数组来填满此空间。 具体做法:修改C: Boot.ini文件如下 timeout=30SimWe个人空间 default=multi(0)disk(0)rdisk(0)partition(2)WINNT multi(0)

6、disk(0)rdisk(0)partition(2)WINNT=? /3GB 注意后面的/3GB就是后加上的。重新启动系统再次运行matlab。Using the 3GB Switch on Windows SystemsMicrosoft Windows XP systems can allocate 3 GB (instead of the default 2 GB) to processes, if you set an appropriate switch in the boot.ini file of the system. MathWorks recommends that yo

7、u only do this with Windows XP SP2 systems or later. This gives an extra 1 GB of virtual memory to MATLAB, not contiguous with the rest of the memory. This enables you to store more data, but not larger arrays, as these are limited by contiguous space. This is mostly beneficial if you have enough RA

8、M (e.g., 3 or 4 GB) to use it.After setting the switch, confirm the new value of the virtual memory after restarting your computer and using the memory function.userview systemview = memory;systemview.VirtualAddressSpaceans = Available: 1.6727e+009 % Virtual memory available to MATLAB. Total: 2.1474

9、e+009 % Total virtual memoryFor more documentation on this option, use the following URL:http:/ on machines running Microsoft Windows Vista and Windows 7, you can achieve the same effect by using the command:BCDEdit /set increaseuserva 3072For more information on this option, go to the following web

10、site:http:/如何启用物理地址扩展 (PAE)启用物 如何禁用PAE模式理地址扩展 (PAE) X86 1.打开 Windows 资源管理器。 2.在“工具”菜单上,单击“文件夹选项”。 3.在“查看”选项卡上,单击“显示所有文件和文件夹”,清除“隐藏受保护的操作系统文件”复选框,然后单击“确定”。如果显示警告对话框,单击“是”以继续。 4.在根文件夹(如 C:)下查找 Boot.ini 文件并删除它的只读属性。 5.打开 Boot.ini 文件,然后将 /PAE 参数添加到 ARC 路径中,如以下 Windows Server 2003 Datacenter Edition 示例所示

11、: multi(0)disk(0)rdisk(0)partition(2)%systemroot%=Windows Server 2003, Datacenter Edition /PAE 以xp为例,修改页面Boot.ini文件如下: timeout=30 default=multi(0)disk(0)rdisk(0)partition(1)WINDOWS operating systems multi(0)disk(0)rdisk(0)partition(1)WINDOWS=Microsoft Windows XP Professional /noexecute=optin /fastde

12、tect /PAE 6.在“文件”菜单上,单击“保存”。 7.还原 Boot.ini 文件的只读属性。 8.为使更改生效,请重新启动计算机。 Windows 7 下开启PAE3GB PAE 由于Windows 7中取消了原来的Boot引导方式,因而我们要在CMD下进行修改。 1.打开CMD:开始运行输入CMD,确定。 2. 在cmd中输入: bcdedit /set pae forceenable 这里的bceddit是关于命令行的启动配置编辑器。 使用上面的命令,你能启用物理地址扩展(PAE),让支持的内存大于4GB; 3GB 因为32位windows默认应用程序只能使用2G内存,剩下的都保

13、留给系统内核了,所以还要开启3GB 在cmd中输入: bcdedit /set increaseuserva 3072 来使得windows把2G以上的内存也分配给应用 程序! 编辑本段禁用PAE模式方法右击桌面“我的电脑”属性,选择“高级”,再点击“启动与恢复”下面的“设置”,再点击框中的“编辑”键,此时会打开BOOT.INI文件, 然后将文件的此行“multi(0)disk(0)rdisk(0)partition(1)WINDOWS=Microsoft Windows XP Professional /noexecute=optin /fastdetect”中的/noexecute=opt

14、in改成/execute 改完后保存该文件,然后重启电脑便OK。 运行时会提示:“Virtual PC在PAE模式下无法运行,请恢复正常状态运行物理地址扩展”解决方法就是 禁用PAE模式方法具体步骤:右击桌面“我的电脑”属性,选择“高级”,再点击“启动与恢复”下面的“设置(T)”,再点击框中的“编辑(E)”键,此时会打开BOOT.INI文件,然后找到文件中的程序代码multi(0)disk(0)rdisk(0)partition(1)WINDOWS=Microsoft Windows XP Professional/noexecute=optin /fastdetect这行代码,将其中的程序代码/noexecute=optin改成程序代码/execute=optin改完后的代码应该为:程序代码multi(0)disk(0)rdisk(0)partition(1)WINDOWS=Microsoft Windows XP Professional/execute=optin /fastdetect改完后保存该文件,然后重启电脑

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 生活休闲 > 社会民生

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号