为什么max heap在运行时会发生变化? [英] Why max heap is changing at runtime?

查看:134
本文介绍了为什么max heap在运行时会发生变化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个在openjdk8中运行的Java应用程序,其最大堆内存在运行时发生变化 - 可能是什么原因?



我发现问题

解决方案

您正在使用并行GC默认情况下启用自适应大小策略。

如果您不希望堆代生成大小,请设置 -XX:-UseAdaptiveSizePolicy


We have a Java application running in openjdk8 whose max heap memory changes at runtime - what might be the reason of that?

I have found question Why the heap is changing in java which points to the article which explains difference between max and committed memory. It seems that in our case these two are usually the same, but not always - see at 11:53 on screenshots below.

Heap can be also changed be young generation serial collector (-XX:MaxHeapFreeRatio, see Encourage the JVM to GC rather than grow the heap?), however we use parallel collector so this is not the case.

The memory related JVM parameters that we run the application with:

-XX:MaxMetaspaceSize=200M -Xms2000m -Xmx2000m

Not sure if it's related, the application was doing parallel mark sweep on old generations between 11:55 and 11:58 - at this time there was over 200MB free memory available and we cannot see any reason for that behaviour.

解决方案

You are using Parallel GC which has adaptive size policy on by default.
Set -XX:-UseAdaptiveSizePolicy if you don't want heap generations to resize.

这篇关于为什么max heap在运行时会发生变化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆