﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-feifeirao-文章分类-JUNIT</title><link>http://www.blogjava.net/feifeirao/category/22382.html</link><description /><language>zh-cn</language><lastBuildDate>Wed, 30 May 2007 13:04:55 GMT</lastBuildDate><pubDate>Wed, 30 May 2007 13:04:55 GMT</pubDate><ttl>60</ttl><item><title>遭遇OutOfMemoryError</title><link>http://www.blogjava.net/feifeirao/articles/116988.html</link><dc:creator>五味子</dc:creator><author>五味子</author><pubDate>Sat, 12 May 2007 07:16:00 GMT</pubDate><guid>http://www.blogjava.net/feifeirao/articles/116988.html</guid><wfw:comment>http://www.blogjava.net/feifeirao/comments/116988.html</wfw:comment><comments>http://www.blogjava.net/feifeirao/articles/116988.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/feifeirao/comments/commentRss/116988.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/feifeirao/services/trackbacks/116988.html</trackback:ping><description><![CDATA[<p class=fp>进行运行全部的测试用例的时候发现不能运行完了，到了后面的一些测试用例的时候出现OutOfMemoryError，程序并没有什么大内存消耗，上网查了一下，发现可能是junit导致的，因为<a href="http://www.symphonious.net/2006/09/19/junit-memory-usage-in-eclipse/"><u><font color=#0000ff>teardown并没有清理掉使用过的内存</font></u></a>，没有办法，只能修改Run的时候的参数，把内存加大，问题解决。<br>Eclipse启动JUnit的时候设置的值大概是64M左右，而我加大内存后监控内存使用的结果表明全部的测试用例需要使用100M内存。<br>方法为：Run-&gt;Run&#8230;-&gt;JUnit-&gt;AllTests-&gt;(x)=Arguments-&gt;VM Arguments: -Xmx500m<br>注意上面的AllTests为自己要修改的那个包含全部测试用例的Test suite的类。 </p>
<script language=JavaScript>
<!--
if (window.location.href.indexOf("http://www.jiehoo.com/")!=0) {
window.location="http://www.jiehoo.com/eclipse-throw-outofmemoryerror-when-run-junit.htm";
}
//-->
</script>
<img src ="http://www.blogjava.net/feifeirao/aggbug/116988.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/feifeirao/" target="_blank">五味子</a> 2007-05-12 15:16 <a href="http://www.blogjava.net/feifeirao/articles/116988.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>