「爲代碼緩存無法保留足夠的空間」,我有以下問題:Java的失敗
$ java -jar program.jar
Error occurred during initialization of VM
Could not reserve enough space for code cache
由系統看到的內存容量似乎足夠了:
$ free -m
total used free shared buffers cached
Mem: 5959 640 5318 0 0 390
-/+ buffers/cache: 249 5710
Swap: 4099 0 4099
我嘗試降低堆設置低至16MB,但它沒有幫助:
$ java -Xmx16m -Xms16m -jar program.jar
Error occurred during initialization of VM
Could not reserve enough space for code cache
什麼可能是錯的?我怎樣才能調試呢?
編輯: 忘了包括版本 - 我使用Sun Java 7u15,64位。我實際上無法讓它顯示一個版本字符串,因爲「java -version」失敗時會出現相同的錯誤。
而且,由於某些原因,如果我使用的OpenJDK 6u27,它啓動 - 但是由於應用希望Java 7中,這是行不通的。
已經回答了這裏: http://stackoverflow.com/questions/7350486/error-occurred-during-initialization-of-vm-could-not-reserve-enough-space-for-o – Vitaly 2013-04-04 13:44:48
@維塔利 - 正如我在問題中所述,我已經嘗試過-Xmx低至16 MB - 並且「free -m」報告的內存足夠大 – Rogach 2013-04-04 13:45:49
也許'16m'是不夠的。再試試! – boomz 2013-04-04 13:48:17