<div class="antChinaText" style="line-height: 1.6; zoom: 1; margin: 10px 0px; padding-left: 10px; font-size: 10.5pt; word-wrap: break-word; font-family: SFNSText, 'Helvetica Neue', 'Microsoft Yahei', SimHei, sans-serif;">1、修改eclipse.ini<p style="margin-top: 0px; margin-bottom: 15pt; padding-top: 0px; padding-bottom: 0px;"></p>在Myeclipse安装目录下G:\MyEclipse8.5\Genuitec\MyEclipse 8.5有一个myeclipse.ini配置文件,设置如下:<p style="margin-top: 0px; margin-bottom: 15pt; padding-top: 0px; padding-bottom: 0px;"></p>-vmargs -Xmx512m -XX:MaxPermSize=256m -XX:ReservedCodeCacheSize=64m<p style="margin-top: 0px; margin-bottom: 15pt; padding-top: 0px; padding-bottom: 0px;"></p>2、设置Default VM Arguments<p style="margin-top: 0px; margin-bottom: 15pt; padding-top: 0px; padding-bottom: 0px;"></p>在myEclipse中,打开Windows-> Preferences->Java->Installed JREs->点击正在使用的JDK->Edit->Default VM Arguments文本框中输入:-Xms64m -Xmx256m<p style="margin-top: 0px; margin-bottom: 15pt; padding-top: 0px; padding-bottom: 0px;"></p>3、如果是web工程还报内存溢出,可能就要设置tomcat内存。<p style="margin-top: 0px; margin-bottom: 15pt; padding-top: 0px; padding-bottom: 0px;"></p>(1)tomcat的安装根目录%tomcat%bin/catalina.bat文件,SET JAVA_OPTS 一行; set JAVA_OPTS=-Xms1024m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=256m 里面的值可以根据项目的具体情况和机器的具体情况作调整<p style="margin-top: 0px; margin-bottom: 15pt; padding-top: 0px; padding-bottom: 0px;"></p>(2)myeclipse配置web服务器配置 Window—Preferences—Myeclipse—Servers—tomcat 5.x—JDK的Optional Java VM arguments配置为:<p style="margin-top: 0px; margin-bottom: 15pt; padding-top: 0px; padding-bottom: 0px;"></p>-Xms256m -Xmx512m -XX:MaxNewSize=256m -XX:MaxPermSize=256m<p style="margin-top: 0px; margin-bottom: 15pt; padding-top: 0px; padding-bottom: 0px;"></p>4、如果是debug模式运行,需要调整debug的虚拟机参数,因为debug模式的默认内存分配时很少的。<p style="margin-top: 0px; margin-bottom: 15pt; padding-top: 0px; padding-bottom: 0px;"></p>5,如果是eclipse跑junit测试遇到内存问题 进行运行全部的测试用例的时候发现不能运行完了,到了后面的一些测试用例的时候出现OutOfMemoryError,是junit导致的,因为teardown并没有清理掉使用过的内存,只能修改Run的时候的参数,把内存加大。 Eclipse启动JUnit的时候设置的值大概是64M左右,而我加大内存后监控内存使用的结果表明全部的测试用例需要使用100M内存。 方法为:Run->Run…->JUnit->AllTests->(x)=Arguments->VM Arguments: -Xmx500m 注意上面的AllTests为自己要修改的那个包含全部测试用例的Test suite的类。<p style="margin-top: 0px; margin-bottom: 15pt; padding-top: 0px; padding-bottom: 0px;"></p>-Xmn是年轻代,一般不要超过堆大小(-Xms和-Xmx)的一半<p style="margin-top: 0px; margin-bottom: 15pt; padding-top: 0px; padding-bottom: 0px;"></p></div><div class="antChinaLinks" style="font-size: 10.5pt; margin-left: 10px; font-family: SFNSText, 'Helvetica Neue', 'Microsoft Yahei', SimHei, sans-serif;"><p style="margin-top: 0px; margin-bottom: 15pt; padding-top: 0px; padding-bottom: 0px;">蚂蚁中国开源社区只负责进行开源项目和代码的传递,青年我看好你: <a target=_blank href="http://www.taoon.cn/" style="color: rgb(62, 98, 166); text-decoration: none;">http://www.taoon.cn</a></p></div>
Myeclipse内存不足
最新推荐文章于 2018-04-18 09:20:34 发布