이 내 스크립트 (난 그냥 더 큰 문제를 해결하기 위해 실험을 시도하고있다) :Java 메모리를 시작하는 데 필요한 메모리 양은 얼마입니까?
간단히 말해서#!/bin/bash
JAVA_OPTS="-Xms64m -Xmx64m"
for i in 1 2 3 4 5 6 7 8 9 10
do
/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java -version &
done
, 내가 같은 시간에 10 개 자바 프로세스를 시작하기 위해 노력하고있어. 서버에는 512MB의 RAM과 4Gb의 스왑이 있습니다. 이는 각각 64MB의 10 개 프로세스에 충분합니다. 그러나이 두 가지 결과물에서 볼 수 있습니다.
Error occurred during initialization of VM
Could not reserve enough space for the card marking array
Error occurred during initialization of VM
Could not reserve enough space for code cache
왜 이런 현상이 발생합니까? 해결 방법?
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 160088 bytes for HashtableBucket in /build/buildd/openjdk-7-7u21-2.3.9/build/openjdk/hotspot/src/share/vm/utilities/hashtable.inline.hpp
# 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=
내 경우 다음 중 하나입니다 :
추락 과정이 시작과 함께 파일을 만들어?
나는 그것에 대해 확신하지는 않지만 JVM을 시작할 때 시작시 args에 주어진 모든 메모리가 필요하다고 생각합니다. 따라서 640M이 필요합니다 ... –
4GB의 스왑은 JVM의 메모리로 간주되지 않습니다. – yegor256
'-Xmx'는 최대 힙 크기를 정의합니다. 전체 Java 프로세스는 그 이상의 메모리를 사용합니다. – assylias