Jetty 9 + Java > 8u74 always allocates maximum (-Xmx) memory on Linux?

烈酒焚心 提交于 2019-12-23 16:32:55

问题


If I start a Java application using jre 8u74 on Linux using -Xmx512m the memory is not allocated immediately, the memory is allocated if Java needs it. So it can stay below the 512 MB limit if not necessary. This is what I would expect.

On Java 8u111 I get another behavior, the 512 MB of memory is always allocated immediately to the process even if Java does not need it. This is annoying since this memory cannot be used by other processes, even if Java does not need it.

I looked trhough the release notes for the Java jre's starting with 8u74 till the currently newst 8u111 but I cannot find any reference to a change in the memory allocation strategy.

Can someone confirm this allocation strategy change within the Java 8 range? Is there an option to have the previous memory allocation behavior?

Edit 1 - -XX:+PrintFlagsFinal diff (as suggested by the8472)

diff java-info-8u111.txt java-info-8u74.txt 
161d160
<      bool CrashOnOutOfMemoryError                   = false                               {product}
199d197
<      bool ExitOnOutOfMemoryError                    = false                               {product}
636d633
<      bool UseCountedLoopSafepoints                  = false                               {C2 product}
666,668d662
<      bool UseMontgomeryMultiplyIntrinsic            = false                               {C2 product}
<      bool UseMontgomerySquareIntrinsic              = false                               {C2 product}
<      bool UseMulAddIntrinsic                        = false                               {C2 product}
698d691
<      bool UseSquareToLenIntrinsic                   = false                               {C2 product}
729,731c722,724
< java version "1.8.0_111"
< Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
< Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
---
> java version "1.8.0_74"
> Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
> Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)

Edit 2 - Related Issues

  • https://github.com/eclipse/jetty.project/issues/575
  • Java 8 with Jetty on linux memory issue
  • Jetty startup delay due to scanning

Edit 3 - Solution

The problem is related to the combination Java8/9 and Jetty9. A workaround is to comment out the contents of the Jetty annotations.mod. See my complete answer to this related question.
Thanks for all suggestions and new debugging ideas.

来源:https://stackoverflow.com/questions/40807646/jetty-9-java-8u74-always-allocates-maximum-xmx-memory-on-linux

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!