The memory usage goes above the max allocated in Prism. I thought it was a memory leak by some mod, but I have disabled EVERYTHING, so im stock 1.12.2, and tested limiting it to 1GB to see what happens:

[https://imgur.com/a/r0rhNXw](https://imgur.com/a/r0rhNXw)

Here you can see, +2GB being used, but limit is allocated to 1GB (ingame screenshot)

This is with only Optifine and Forge installed:

[https://imgur.com/a/37ZvagJ](https://imgur.com/a/37ZvagJ)

I normally play with 512 minimum 8 GB max, but I have realized that this is ignored, it always goes beyond that, so when I start adding mods, it goes crazy high:

[https://i.imgur.com/WXA1m01.png](https://i.imgur.com/WXA1m01.png)

As you can see, it goes up to 14GB

I have been trying to use Shenandoah GC for better performance, and set it to 16GB min and max (I have 32GB total) and I couldn’t use it since I was using almost all of my RAM so I would have nothing left for OBS:

[https://imgur.com/a/0ZJ2M2w](https://imgur.com/a/0ZJ2M2w)

I thought mods were causing this, but after removing everything, it looks like the problem starts Minecraft itself not respecting the amount of allocated ram, so when you start adding stuff up, it’s more noticeable. Not sure if technically you could call this a memory leak, it does’t seem to consume infinite memory until it crashes, but it does not respect the limits. I was expecting that if I set 8GB, I would have the rest of RAM free to use, but if it ends up consuming up to 14GB+, what’s the limit of setting a limit of 8GB anyway?

Anyone has any idea how to solve this?

My specs: Windows 10 CPU: 3950X GPU: 1660gt RAM: 32GB SSD: 970 Evo m.2

I need to use 1.12.2 because some stuff I need is only availible for this version so updating is out of the question. If anyone has a solution it would be much appreciated.

EDIT: I have found this:

[https://github.com/sp614x/optifine/issues/1856](https://github.com/sp614x/optifine/issues/1856)

>”Java can allocate heap memory (seen by java programs) up to the given maximum. It can also allocate additional native memory (buffers, etc) also up to the given maximum. Additionally the Java Virtual Machine itself needs memory in order to run.
>
>As a result it is normal for Java effectively to allocate twice as much as the given maximum.
>
>In 1.13 Minecraft started to use libraries which allocate native memory outside of the Java memory. As a side effect the Java memory is not used so much as in 1.12. This means that the memory limit can be reduced. For example in the above screenshot 600 MB are allocated of which 400 MB are used, so the limit could be set to 600 or even 500 MB.
>
>Using higher render distance or HD resource packs would need more memory.”

So apparently, even if you set the maximun to 8GB, it can go way higher than 8GB, even as high as twice? tf man. So how are you supposed to predict how much free ram are you going to have? I need free ram to record with OBS. So basically, 8GB, I can expect the JVM to use up to 16GB? And there’s no way to predict what would be the limit? Wow, amazing.

by amazingpacman

1 Comment

  1. `xms` and `xmx` are limits for the heap, and the JVM has more overhead than heap alone (It must also sustain itself, the JVM), so that explains the behavior in the first screenshot.

    As for the next few:

    * What are your args? There might be some flags you’re setting with behaviors you don’t intend
    * Is memory usage increasing with time, or is it just hovering at more-than-expected? (Hallmark of memory leak is increasing resource consumption with time).

Leave A Reply