java虚拟机内存不足“CouldnotcreatetheJavaVirtualMachine”问题解决方案.docx_第1页
java虚拟机内存不足“CouldnotcreatetheJavaVirtualMachine”问题解决方案.docx_第2页
java虚拟机内存不足“CouldnotcreatetheJavaVirtualMachine”问题解决方案.docx_第3页
java虚拟机内存不足“CouldnotcreatetheJavaVirtualMachine”问题解决方案.docx_第4页
java虚拟机内存不足“CouldnotcreatetheJavaVirtualMachine”问题解决方案.docx_第5页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

大概原因,就是java堆内存不足以运行JVM,需要增加内存。网上搜索此问题,大部分都是针对某个程序进行修改JVM内存的解决方法,比如eclipse,等。试问,若是其他程序出现问题了呢?现在给出一个全局的java虚拟机修改内存的方法。在WIN XP,WIN 7,WIN8都可以。解决方案:增加一个系统环境变量变量名:_JAVA_OPTIONS变量值:-Xmx512M保存后,就OK!下面给出关于java堆内存的一个介绍,这是一个英文网页的翻译过来的。关于java堆内存:Java -Xmx is the configuration parameter to control the amount of memory Java uses on a system. Basically these settings are there to control the Heap memory size of Java. There are two settings related to Java heap memory: -Xmx to set the maximum heap memory size -Xms to set the minimum heap memory sizeTips to set the Java heap memory sizeManaging the Java heap memory size for a server is very crucial as the whole performance depends on this memory size, off course there are other factors which affects the performance. So lets see how you can set these parameters to control the Java heap memory size.Do not set -Xmx to too small valueIf you set -Xmx too small for your server then your application may not work properly and you may get Out of memory exception. So never set this too small as this is the maximum amount of memory you are allocating for Java and it cannot utilize memory beyond the set value.It is always advisable to set -Xmx to a higher value if you have enough memory space available on your server. On the other hand if you set -Xmx value to a higher value your other resources will not be able to perform well as you have already reserved some of your memory for Java. So before setting the maximum heap size memory just check how much memory is free. To do so, stop your application server and check the free memory and accordingly you can set the maximum memory size. For example if you have 512M free memory then you can set heap memory to 300M safely i.e. -Xmx300m.Set -Xms to a small valueIf you set -Xms to higher value you might run out of memory. So always try to keep it to a small value like -Xms16m. In tomcat when you restart the server it starts a Java process and that process takes the same -Xms as the default value for the tomcat and if it is higher you may get out of memory.Now lets see how to set java heap memory in different servers.How to set java heap size in TomcatTo set the java heap size in tomcat you need to edit the catalina.sh (On Linux) or catalina.bat (On Windows) file. You can find these files inside the bin directory of tomcat. Open the appropriate file and search for CATALINA_OPTS and set the value as shown below, you can change the max and min value to whatever you want.set CATALINA_OPTS=-Xms64m -Xmx512mexport 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堆内存。如何设置Tomcat java堆大小 设 置java堆大小在tomcat中您需要编辑catalina.sh(在Linux上)或catalina。 蝙蝠(在Windows上)文件。 你可以找到这些

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论