亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Java.lang.OutOfMemoryError:Java 堆空間

Java.lang.OutOfMemoryError:Java 堆空間

慕碼人8056858 2022-06-23 17:00:10
我正在嘗試運行我的代碼,但在我的控制臺上出現此錯誤 [java] Caused by: java.lang.OutOfMemoryError: Java heap space我在 jdk 文件夾上運行 Jconsole 最大堆 1.9m,我該如何更改它?
查看完整描述

2 回答

?
森林海

TA貢獻2011條經驗 獲得超2個贊

至于 hybris,需要更新 tomcat.generaloptions 屬性來調整 Xmx 值。例如,通過 local.properties。-Xmx2G 是默認值。

tomcat.generaloptions=-Xmx4G -ea -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dorg.tanukisoftware.wrapper.WrapperManager.mbean=true -Djava.endorsed.dirs="%CATALINA_HOME%/lib/endorsed" -Dcatalina.base=%CATALINA_BASE% -Dcatalina.home=%CATALINA_HOME% -Dfile.encoding=UTF-8  -Djava.util.logging.config.file=jdk_logging.properties -Djava.io.tmpdir="${HYBRIS_TEMP_DIR}"



查看完整回答
反對 回復 2022-06-23
?
隔江千里

TA貢獻1906條經驗 獲得超10個贊

-Xmx size您可以使用命令行參數配置最大堆大小。默認為 64mb。你看到的 1.9m 看起來很奇怪。


這是 java 命令的 Oracle 文檔: https ://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html


具體來說:


-Xmx大小


Specifies the maximum size (in bytes) of the memory allocation pool in bytes. This value must be a multiple of 1024 and greater than 2 MB. Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, g or G to indicate gigabytes. The default value is chosen at runtime based on system configuration. For server deployments, -Xms and -Xmx are often set to the same value. See the section "Ergonomics" in Java SE HotSpot Virtual Machine Garbage Collection Tuning Guide at http://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/index.html.


The following examples show how to set the maximum allowed size of allocated memory to 80 MB using various units:


-Xmx83886080

-Xmx81920k

-Xmx80m

The -Xmx option is equivalent to -XX:MaxHeapSize.


查看完整回答
反對 回復 2022-06-23
  • 2 回答
  • 0 關注
  • 137 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號