java虚拟机内存不足, “Could notcreatetheJava Virtual
Machine”问题解决方案
大概原因就是java堆内存不足以运行JVM需要增加内存。
网上搜索此问题大部分都是针对某个程序进行修改JVM内存的解决方法 比如ecl ipse,等。试问若是其他程序出现问题了呢
现在给出一个全局的java虚拟机修改内存的方法。在WINXP,WIN 7,WIN8都可以。 解决方案增加一个系统环境变量
变量名 _JAVA_OPTIONS
变量值 -Xmx512M
保存后就OK! !
下面给出关于java堆内存的一个介绍这是一个英文网页的翻译过来的。
关于java堆内存
Java-Xmxis theconfiguration parametertocontrol the amountof memoryJava useson asystem.Basical lythesesettingsaretheretocontrol the Heap memorysizeof Java.Therearetwosettings relatedtoJava heap memory:
?
?-Xmxtoset themaximum heapmemorysize-Xmstoset theminimum heapmemorysize
Tipstoset theJava heap memorysize
ManagingtheJava heap memorysizeforaserver isverycrucial asthe whole performancedepends on this memorysize,off coursethere areother factors which affects the performance.So let’s see howyou can set these parameters tocontrol theJava heap memorysize.
Donot set -Xmxtotoosmal lvalue
If youset -Xmxtoosmal l foryourserverthenyourappl ication maynot work properlyandyou maygetOutof memoryexception.So neverset this too smal las this is themaximumamountof memoryyouareal locatingforJava anditcannotuti l izememorybeyondthesetvalue.
It isalwaysadvisabletoset -Xmxtoa highervalueif you haveenough memoryspaceavai lableonyourserver.Ontheotherhandif youset -Xmx valuetoahighervalueyourother resourceswi l l notbeabletoperformwel las you have already reserved some of your memoryforJava.So beforesetting themaximum heapsizememoryjustcheckhowmuch memoryis free.Todo so, stopyourappl ication serverand checkthefreememoryand accordingly you canset themaximum memorysize. Forexampleif you have512M free memorythenyou can set heap memoryto300M safelyi .e. -Xmx300m.
Set -Xmstoasmal lvalue
If youset -Xms tohighervalueyou might runoutof memory.Soalways trytokeepit toasmal lvaluel ike-Xms16m. Intomcatwhenyou restart the
server it starts aJava processandthat process takes thesame-Xmsas the defaultvalueforthetomcatand if it is higheryou maygetoutof memory.
Nowlet’s seehowtosetjava heap memory in different servers.
Howtosetjava heapsizeinTomcat
Toset thejava heapsizeintomcatyou needtoedit thecatal ina.sh(On Linux)orcatal ina.bat (OnWindows) fi le.Youcanfindthesefi les insidethebin directory of tomcat.Open theappropriatefi le and search forCATALINA_OPTS andset thevalueas shownbelow,youcan changethemaxandminvalueto whateveryou want.set CATALINA_OPTS=-Xms64m-Xmx512m
export CATALINA_OPTS=”-Xms64m-Xmx512m”setenv CATALINA_OPTS“-Xms64m-Xmx512m”
大概翻译如下
Java-xmx配置参数控制Java系统上使用的内存量。 基本上这些设置有控制Java堆内存的大小。 有两种设置相关的Java堆内存:
?
?-xmx设置最大的堆内存的大小xms设置最小堆内存大小建议设置Java堆内存大小
管理服务器的Java堆内存大小是非常重要的整个性能取决于这个内存大小,当然还有其他因素影响性能。 所以让我们来看看你可以设置这些参数来控制Java堆内存大小。 不设置-xmx太小价值
如果你为你的服务器设置-xmx太小,那么您的应用程序可能无法正常
工作,你可能会得到内存不足异常。 所以不要设置过小,因为这是你们的最大内存分配为Java和它不能利用内存超出设定的值。
它总是明智的-xmx较高的值,如果你有足够的内存空间可用的服务器上。 另一方面如果你-xmx值设置为较高的值其他资源将无法执行以及你已经保留你的一些Java内存。 所以设置最大堆大小的内存之前就检查多少内存是免费的。 为此,停止应用服务器并检查空闲内存,因此您可以设置最大的内存大小。 例如,如果你有512的空闲内存,那么你可以设置堆内存300安全即-Xmx300m。xms设置为一个较小的值
如果你设置xms更高的值可能会耗尽内存。 所以总是试图保持它像-Xms16m一个较小的值。 在tomcat中当你重新启动服务器,启动一个Java 进程,过程需要相同的xms tomcat的默认值,如果它是更高的你可能会失去记忆。
现在让我们看看如何在不同的服务器上设置java堆内存。
如何设置Tomcatjava堆大小
设置java堆大小在tomcat中您需要编辑catal ina.sh(在Linux上)或catal ina。 蝙蝠(在Windows上)文件。 你可以找到这些文件在tomcat的bin目录。打开相应的文件和搜索CATALI NA_OPTS和设置值如下所示,你可以改变任何你想要的最大和最小值。 设置CATALINA_OPTS=-Xms64m -Xmx512m
出口CATALINA_OPTS=" -Xms64m-Xmx512m”setenv CATALINA_OPTS”-Xms64m-Xmx512m”
华纳云双11钜惠出海:CN2海外物理服务器终身价688元/月,香港/美国机房,免费送20G DDos防御,50M CN2或100M国际带宽可选,(文内附带测评)华纳云作为一家专业的全球数据中心基础服务提供商,总部在香港,拥有香港政府颁发的商业登记证明,APNIC 和 ARIN 会员单位。主营香港服务器、美国服务器、香港/美国OpenStack云服务器、香港高防物理服务器、美国高防服务器、香港高防I...
目前,我们都在用哪个FTP软件?喜欢用的是WinSCP,是一款免费的FTP/SFTP软件。今天在帮助一个网友远程解决问题的时候看到他用的是FlashFXP FTP工具,这个工具以前我也用过,不过正版是需要付费的,但是网上有很多的绿色版本和破解版本。考虑到安全的问题,个人不建议选择破解版。但是这款软件还是比较好用的。今天主要是遇到他的虚拟主机无法通过FTP连接主机,这里我就帮忙看看到底是什么问题。一...
提速啦 成立于2012年,作为互联网老兵我们一直为用户提供 稳定 高速 高质量的产品。成立至今一直深受用户的喜爱 荣获 “2021年赣州安全大赛第三名” “2020创新企业入围奖” 等殊荣。目前我司在美国拥有4.6万G总内存云服务器资源,香港拥有2.2万G总内存云服务器资源,阿里云香港机房拥有8000G总内存云服务器资源,国内多地区拥有1.6万G总内存云服务器资源,绝非1 2台宿主机的小商家可比。...