Ubuntu 上仅启动一个 Java 程序

Ubuntu 上仅启动一个 Java 程序

我有一个 Ubuntu 服务器

# uname -a
Linux  2.6.18-028stab064.7 #1 SMP Wed Aug 26 13:11:07 MSD 2009 i686 GNU/Linux

Java 通过此选项启动(如果没有额外的选项则无法启动):

Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m

我可以运行 1 个 Java 进程(它是一个基于 Jetty 的独立进程)

当我想启动另一个 Java 进程时,我得到了这个:

# java -version
Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m
Error occurred during initialization of VM
Could not reserve enough space for code cache

服务器内存

# top
top - 11:20:22 up 20 days, 13:15,  1 user,  load average: 0.00, 0.02, 0.05
Tasks:  46 total,   2 running,  44 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   5123756k total,   170260k used,  4953496k free,        0k buffers
Swap:        0k total,        0k used,        0k free,        0k cached



# java -version
Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
Java HotSpot(TM) Client VM (build 17.0-b16, mixed mode)


# file java
java: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), not stripped

# ulimit -a
core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 16383
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 16383
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

答案1

oracle 的错误数据库只讲述了 64 位和 1.5 版本系统的一些信息:
https://bugs.java.com/bugdatabase/view_bug?bug_id=6245770

但也许你在另一个版本中发现了这个错误?你是否尝试过这个参数来减少代码缓存的大小?-XX:ReservedCodeCacheSize=48m

错误数据库中提到了更多参数,也许您可​​以尝试它们并测试错误是否仍然发生。

相关内容