Dreaded无法为对象堆保留足够的空间

时间:2009-12-19 19:00:48

标签: java unix memory-leaks solr

我试图让Solr启动并运行,起初我让JDK.1.6运行正常,然后tomcat运行正常。当我第一次尝试运行Solr时,我突然收到错误消息:

[root@78 bin]# ./java -version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

我删除了Tomcat,删除了JDK并重新安装了最新的JRE,但即使在尝试获取Java的版本号时仍然会收到错误消息。

top - 18:47:15 up 207 days, 13:50,  1 user,  load average: 0.08, 0.03, 0.00
Tasks:  42 total,   1 running,  41 sleeping,   0 stopped,   0 zombie
Cpu(s):  5.0%us,  0.2%sy,  0.0%ni, 94.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:    786432k total,   376656k used,   409776k free,        0k buffers
Swap:        0k total,        0k used,        0k free,        0k cached

我的设置是:双CPU双核AMD Opteron 512MB RAM 40GB硬盘

我几乎不熟悉UNIX,所以任何帮助或建议都会非常有用,谢谢你们

编辑运行过程是:

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
    1 root      18   0 10332  636  600 S    0  0.1   0:08.28 init
 1752 psaadm    15   0  176m  29m  17m S    0  3.9   0:03.76 httpsd
 1785 psaadm    15   0  173m  24m  14m S    0  3.1   0:02.03 httpsd
 5308 psaadm    15   0  174m  32m  21m S    0  4.2   0:02.70 httpsd
 6107 apache    25   0  347m  47m 5616 S    0  6.2   1:48.26 httpd
11493 root      15  -4 12588  320  316 S    0  0.0   0:00.00 udevd
12105 root      15   0 60592 1224  676 S    0  0.2   0:00.00 sshd
13659 apache    15   0  345m  46m 4784 S    0  6.1   0:57.14 httpd
15855 root      15   0 21628  768  672 S    0  0.1   0:13.75 xinetd
15986 root      15   0 40848  592  536 S    0  0.1   0:00.38 couriertcpd
16086 root      18   0 33540 1184 1120 S    0  0.2   0:00.28 courierlogger
16117 root      21   0 40848  536  532 S    0  0.1   0:00.00 couriertcpd
16119 root      21   0 33544 1072 1068 S    0  0.1   0:00.00 courierlogger
16135 root      15   0 40848  592  536 S    0  0.1   0:03.09 couriertcpd
16137 root      18   0 33540 1184 1120 S    0  0.2   0:01.70 courierlogger
16154 root      18   0 40852  536  532 S    0  0.1   0:00.00 couriertcpd
16157 root      18   0 33540 1124 1120 S    0  0.1   0:00.00 courierlogger
16287 qmails    18   0  3832  512  428 S    0  0.1   2:03.49 qmail-send
16289 qmaill    18   0  3780  508  444 S    0  0.1   0:36.67 splogger
16290 root      18   0  3816  408  324 S    0  0.1   0:00.09 qmail-lspawn
16291 qmailr    17   0  3820  404  328 S    0  0.1   0:16.95 qmail-rspawn
16292 qmailq    18   0  3772  368  324 S    0  0.0   0:15.61 qmail-clean
17669 root      18   0 12592 1180  908 R    0  0.2   0:00.03 top
18190 root      15   0  318m  25m 9000 S    0  3.3   0:36.21 httpd
19687 apache    16   0  347m  47m 5764 S    0  6.2   1:10.59 httpd
19710 named     25   0  180m 2572 1744 S    0  0.3   0:03.06 named
19809 root      18   0 11908 1152 1148 S    0  0.1   0:00.01 mysqld_safe
20166 apache    15   0  347m  47m 5696 S    0  6.2   1:07.68 httpd
20340 mysql     15   0  303m  35m 5620 S    0  4.7 185:56.38 mysqld
23747 apache    15   0  412m  46m 5768 S    0  6.0   0:38.23 httpd
23791 root      15   0  166m 7504 4216 S    0  1.0   0:02.39 httpsd
23901 root      15   0 20836  616  548 S    0  0.1   3:37.38 crond
23926 root      18   0 46648  416  412 S    0  0.1   0:00.00 saslauthd
24084 root      18   0 46648  160  156 S    0  0.0   0:00.00 saslauthd
24297 root      15   0 96636 4032 3112 S    0  0.5   0:00.20 sshd
24302 root      18   0 12180 1804 1308 S    0  0.2   0:00.17 bash
24431 root      18   0  152m 1112  664 S    0  0.1   0:25.77 rsyslogd
24435 root      18   0  3784  336  332 S    0  0.0   0:00.00 rklogd
24537 apache    15   0  344m  45m 4364 S    0  5.9   0:35.93 httpd

顺便提一下它是一个共享服务器。

Free -m给了我:

             total       used       free     shared    buffers     cached
Mem:           768        367        400          0          0          0
-/+ buffers/cache:        367        400
Swap:            0          0          0

3 个答案:

答案 0 :(得分:0)

JVM在启动时需要一定的内存(通过-Xms配置 - 默认为32m,我相信)。如果它无法获得它,它将无法启动。

那么你的macine上还有什么东西在运行?我怀疑你的机器上有很少的免费虚拟内存。

答案 1 :(得分:0)

您是否设置了$ JAVA_OPTIONS?

echo $JAVA_OPTIONS

Doest以下命令运行时没有错误?

java -Xmx8m -version

答案 2 :(得分:0)

只需要一次简单的重启,不能让我的生活了解发生了什么或为什么。