0

これは私のスクリプトです (私はより大きな問題を解決するために実験しようとしています):

#!/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個のJavaプロセスを開始しようとしています。サーバーには 512Mb の RAM と 4Gb のスワップがあります。これは、それぞれ 64Mb の 10 個のプロセスには十分すぎるはずです。ただし、これは、そのうちの 2 つの出力に表示されるものです。

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=

私のケースは次のうちどれですか?

4

1 に答える 1