2

我的操作系统版本是 Windows 7 64 位,JDK 是 32 位版本。我成功地启动了我的 JBoss Wrapper 应用程序,但是在它运行了一段时间之后,JVM 失败并重新启动。

JVM 转储日志中的消息是:

#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 543672 bytes for Chunk::new
# Possible reasons:
#   The system is out of physical RAM or swap space
#   In 32 bit mode, the process size limit was hit
# Possible solutions:
#   Reduce memory load on the system
#   Increase physical memory or swap space
#   Check if swap backing store is full
#   Use 64 bit Java on a 64 bit OS
#   Decrease Java heap size (-Xmx/-Xms)
#   Decrease number of Java threads
#   Decrease Java thread stack sizes (-Xss)
#   Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
#  Out of Memory Error (allocation.cpp:328), pid=5480, tid=4740
#
# JRE version: 7.0_05-b05
# Java VM: Java HotSpot(TM) Server VM (23.1-b03 mixed mode windows-x86 )
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#

我在我的计算机上部署了 3 个包装应用程序。它们中的每一个都设置为 700Mb 的最大 JVM 堆大小。

请帮我回顾一下这个问题。谢谢。我的问题是:

  1. 我如何知道当前 JVM 分配的大小?
  2. 这个问题的原因是什么?
  3. 如何解决?有人推荐我使用 64 位 JDK。有必要吗?
4

2 回答 2

2

如果使用32-bit JDK,我们可以设置的最大堆大小,并且仍然具有JVM start up is about 1.2 GB.For larger heaps, we need to run a 64-bit JDK. To run 64-bit JDK, you’d also need a64 位operating system running on a server that has a64 位` CPU。

  1. 下载了JDK 64 bit version

  2. 将 JAVA_OPTS 设置为

     JAVA_OPTS=-Xms1024m -Xmx1024m -XX:MaxPermSize=256m 
    

并参考此链接

这也是一篇关于记忆的好文章。

于 2012-10-08T07:02:21.613 回答
1

32 位 JVM 被限制为最大 2GB 堆 ( -Xmx)。在某些操作系统中,远少于此。

64 位 JVM 将没有此限制。

在 Windows 中,您可以使用 Task Manager->Processes 跟踪 JVM 的内存消耗。

于 2012-10-08T06:54:35.827 回答