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

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