java 使用 虚拟内存_如何减少JVM虚拟内存的使用?

我有一个Java程序可以在具有2GB物理内存和2GB交换的Solaris 10 X86上运行 .

该程序在Linux 64位运行良好,它只消耗大约450MB内存 .

但是当它在Solaris中运行时,它总是报告OutOfMemoryError,并且我注意到在错误发生之前,它试图使用> 4GB的虚拟内存,这在32位系统上绝对不可能 .

那么为什么JVM会尝试使用那么多虚拟内存呢?有没有办法告诉JVM不要使用那么多的虚拟内存?

谢谢 .

编辑:

感谢大家的意见!这是完整的错误消息:

#

# There is insufficient memory for the Java Runtime Environment to continue.

# Native memory allocation (malloc) failed to allocate 32756 bytes for ChunkPool::allocate

# 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:211), pid=1052, tid=16

#

# JRE version: 6.0_26-b03

# Java VM: Java HotSpot(TM) Server VM (20.1-b02 mixed mode solaris-x86 )

--------------- T H R E A D ---------------

Current thread (0x081a3400): JavaThread "C2 CompilerThread1" daemon

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值