# What happens when heap size set by XX:MaxRAMpercentage is exceeded?

**URL:** https://discuss.kubernetes.io/t/what-happens-when-heap-size-set-by-xx-maxrampercentage-is-exceeded/17228
**Category:** General Discussions
**Created:** [August 26, 2021, 9:08pm UTC](https://discuss.kubernetes.io/t/what-happens-when-heap-size-set-by-xx-maxrampercentage-is-exceeded/17228 "2021-08-26T21:08:17Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Growler787](https://avatars.discourse-cdn.com/v4/letter/g/ecc23a/32.png) [@Growler787](https://discuss.kubernetes.io/u/Growler787)
#### Post date: [August 26, 2021, 9:08pm UTC](https://discuss.kubernetes.io/t/what-happens-when-heap-size-set-by-xx-maxrampercentage-is-exceeded/17228/1 "2021-08-26T21:08:17Z")

</div>

Hi.

I am looking into possibilities of using the parameters XX:MInRAMpercentage and XX:MaxRAMpercentage when determining the heap size in a JVM.

Let me show an example:

We have the Kubernetes POD named Pod1.

Inside Pod1 we have:  
limits:  
cpu: “250m”  
memory: “500Mi”  
requests:  
cpu: “250m”  
memory: “250Mi”

If we set XX:MaxRAMpercentage at 50% which means that the heap will be 250 Mi.  
**What will happen when the heap exceeds the value set by XX:MaxRAMpercentage?**  
Garbage Collection?  
Out Of Memory error?

I’ve browsed through the internet but was not able to find any answers on this topic. Therefore I am turning to the community.

Cheers,  
Thomas

---

<div class="post-metadata">

### Author: ![calebAtAmazon](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/calebatamazon/32/18102_2.png) [@calebAtAmazon](https://discuss.kubernetes.io/u/calebAtAmazon)
#### Post date: [March 3, 2026, 5:48pm UTC](https://discuss.kubernetes.io/t/what-happens-when-heap-size-set-by-xx-maxrampercentage-is-exceeded/17228/2 "2026-03-03T17:48:39Z")

</div>

Same question, anyone w/ Java experience know the answer?
