无法为Java分配足够的堆空间 [英] Could not allocate enough heap space to Java

查看:241
本文介绍了无法为Java分配足够的堆空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个运行良好的应用程序,一年。它是一个Web应用程序,运行在Windows Server 2003企业版Service Pack 2上的Microsoft Cluster下的Tomcat 5.5 + JDK 1.5下。该服务器具有11Gb的RAM(我知道它没用!),其描述如下:Physical Address Extension :我不知道这意味着什么。



Tomcat服务配置了以下参数: -Xmx1024m -Xms128m >

我们尝试了几个测试:


  • java -Xmx1024m -version

  • java -Xmx758m -version =>失败

  • java -Xmx512m -version =>通过



使用较少的内存来获得最大的堆大小,但这不是一个可接受的解决方法,因为用户数量会在几个月内增加,我们需要et最大堆大小为1024Mb。

另外我不明白为什么它可以正常工作,然后突然停止工作!看起来操作系统现在无法分配连续的内存或其他内容(页面文件大小,用户内存分配等)。

很难知道是否因为Web应用程序正在客户服务器上运行,所以我们无法访问它。

解决方案

Java需要连续的内存。在32位操作系统上,这限制了Windows在1.2到1.4 GB之间。但是,如果你的内存由于其他正在运行的程序而被分割,你可能会得到一个更小的内存区域。



你不会遇到这个问题,你甚至可以为jVM分配更多的内存(如果你使用的是64位JVM)

We have an application which was running fine for one year. It is a web application, running under Tomcat 5.5 + JDK 1.5 under Microsoft Cluster on Windows Server 2003 Enterprise Edition Service Pack 2. The server has 11Gb of RAM (I know that it is useless!) with the following description "Physical Address Extension": I don't know what that means.

The Tomcat service is configured with the following parameters: -Xmx1024m -Xms128m

Since last week, the service doesn't want to start anymore and stops with the following error message: "Could not allocate enough heap space".

We tried several tests:

  • java -Xmx1024m -version => Failed
  • java -Xmx758m -version => Failed
  • java -Xmx512m -version => Passed

So we can use less memory for the maximum heap size, but it is not an acceptable workaround because the number of users will increase in few months and we need to set the maximum heap size to 1024Mb.

Also I don't understand why it worked fine and then suddenly it stopped working! It seems that the OS is now unable to allocate contiguous memory, or something else (page file size, user memory allocation, ...)

It's quite difficult to know if something changed (OS patch, configuration, ...) because the web application is running on the customer server and we don't have access to it.

解决方案

Java requires continous memory. On 32-bit OSes this limits you to between 1.2 and 1.4 GB on Windows. However if your memory is fragmented due to other programs which are running, you might get a much smaller region of memory.

You won't get this problem with a 64-bit OS and you can even allocate far more memory to the jVM as well (if you use a 64-bit JVM)

这篇关于无法为Java分配足够的堆空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆