mojira.dev

Dan Peretz

Assigned

No issues.

Reported

MC-123378 javaw.exe leaks memory, significantly exceeding the limit specified with -Xmx flag Awaiting Response

Comments

I already tried using my system's Java 9.
It either failed to create a JVM (the game crashing immediately after pressing "Play" in launcher), or crashed when connecting to a multiplayer server.
Eventually I gave up, assuming there is some incompatible API change between Java 8 and 9 and that Minecraft isn't updated to use it.

Should I switch to the parallel garbage collector instead of G1? I saw some people commenting that G1 is more memory-hungry.
Note that the default Minecraft JVM arguments enable G1, and G1 is also the default garbage collector in Java 9 (instead of CMS).

Default JVM arguments in Minecraft:
-Xmx1G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=16M

Yeah I know about this, I searched for info before posting here. I thought it might be caused by a memory leak in one of Minecraft's libraries or something like that.
Anyways, even if it used a bit more than -Xmx, I don't think it is normal for it to use THAT much more memory than -Xmx. Using 4GiB instead of 2GiB seems like an anomaly.
I might be able to limit Java's memory using the -XX:MaxPermSize flag (or something like that) but:

  • It's deprecated in Java 9, which will render this solution irrelevant when Minecraft will switch to Java 9 by default, and

  • I shouldn't be using this flag to limit Minecraft's memory usage; as I understand it, this is an undesirable behavior that is better fixed in the code rather than using temporary workarounds like this

I actually went on and reproduced the issue. See example #3.

It is not possible I have other Java programs running (well, except for the Minecraft launcher).
I am 100% sure I use no other Java program besides Minecraft.
Even if I did use other Java programs, they would have been loaded into a process isolated from the Minecraft's Java process, because of the different JRE.
As you can see in the screenshots I attached, the Minecraft's JRE is not configured to be used by my system.

I am also absolutely sure this bug exists. It occured several times already (more than I can count), and each time I checked the memory usage in Task Manager and it was Minecraft's Java using excessive memory.
The allocated memory size reported by Java itself in the crash report is apparently incorrect.

I literally meant it when I said "I use the official, unmodified Minecraft client" - I don't play with mods (a.k.a. Forge) or use any hacked client or things like that.
The only "mods" are server-side plugins (Bukkit) that do not and cannot affect the memory usage client-side.

In my operating system's Task Manager.