Java Memory leak

Operating System: EndeavourOS
KDE Plasma Version: 6.5.4
KDE Frameworks Version: 6.21.0
Qt Version: 6.10.1
Kernel Version: 6.18.2-arch2-1 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 5800X 8-Core Processor
Memory: 32 GiB of RAM (31.2 GiB usable)
Graphics Processor: NVIDIA GeForce RTX 2070 SUPER
Manufacturer: ASUS

Hello, I post my Problem here since it’s only appears when playing minecraft.
I did A LOT of testing and don’t want to post a gigantic wall of text so I’ll sum it up.

I have memory leaks when playing minecraft, modded and Vanilla, every possible mod combination there is (and yes memory leak fix mods don’t work).
Different Java arguments, different Vendors, my own or automatically downloaded from Modrinth/Prism Launcher/official launcher, different Java versions make no difference at all.
Everything is up-to-date, and I even did a fresh reinstallation, which did nothing.

I looked at it with VirtualVM, free -m for example, tried spark, which is a performance profiler but nothing showed anything related or of help.
Spark showed me that java hangs at some point for a long of time, but I couldn’t find anything related to that.
Obviously, I looked through every log i could find, but to no avail.
The only place where I can reliably see my Memory leaks is in the default systemmonitor which does seem to be accurate after all that testing.

I’m quite frustrated At this point, because I just don’t know anything what I can do to diagnose or fix my problem anymore.
I also couldn’t find any possible solution online, since it all leads to a dead end.

For logs I need to redo my testing, since I didn’t save them, so that would take a day or two if wanted.

I don’t need a perfect solution, but at least a pointer or two would already help immensely.

I’m going to give a little update for anyone that has the same problems as me and comes across this some day. I’m always greatful for the 7+ year old posts i find.

I have still not found a solution, i reinstalled EOS again and finally got my server up and running with vanilla arch. It has Java leaks too, luckily not that dramatic, that i won’t be any big problem but still there.
I give up now, i literally did everything i know, i found and what others have told me to do.

Thank you for returning to share an update @AvisVanBruch.

I can’t speak to Minecraft specifically, but memory leaks in applications are generally a developer issue, not a user issue.

If Minecraft has a “memory leak” when running vanilla, it does seem strange to me that more isn’t said about that in the community.

How are you identifying this memory leak? I know you mentioned “systemmonitor”, but what process are you observing the leak in? What sort of pattern are you observing with its growth over time?

Yeah i know what you mean but too often i did some dumb mistake of forgot something so i really try to get it fixed ^^"

yeah so after all that testing and stuff i did i found out that minecraft itself isn’t necessarily the problem or at least not in the way i thought it is.
Also that Spark can’t see if a process is actually hanging somewhere or waiting, so it waits a long time at some point but idk where, still haven’t found that out.

Please excuse my terrible ability to properly explain stuff, i have no clue what all the technical terms are or what happening is called what.

To your questions:
As in my original post, i used the kde systemmonitor, spark (which apparently isn’t that usefull tbh), VisualVM and the inbuilt commands like free -m, idk where they come form.

So when starting minecraft (it or java, it only shows as java in systemmonmitor), hangs/waits at some point in the starting process and then jumps to something like 10gb of ram. I thought at first that it must be some mods, since i started with a very large modpack.

Proportionaly to the amount of mods the usage/accumulation of ram usage grows ingame.
That is something i very obviously understand how it works, so i run faster out of memory with more mods than less. But with a bit of brute forcing minecraft it even happens in vanilla.

Minecraft itself show normal ram usage in game, like everything works as it should and with a mod called memory sweeper i can verify it. I don’t know how good it works but it seems to work as intended.

So for someone who isn’t very smart it looks like minecraft/java uses resources and accumulate them outside of the minecraft enviroment, which for me sounds like java because what else yould it be?
A friend mentioned that running minecraft with proton/steam could be a fix, he didn’t explained how i can do that tho but i’m about to try starting prism launcher in steam and see if that does anything.

I hope i somehow explained something understandable but tbh i kinda have enough of linux and learning things at this point. I thought it’s a great idead to brute force myself learning linux things since october last year.

How did you install it?

Are you using minecraft-launcher?

This is the official recommended way of running it.

yay -Syu minecraft-launcher

I tried the official minecraft launcher, prism launcher, modrinth launcher each with their own java version and my own. I tried the AUR one too, it had the best launcher performance but still the main problem.

For now, I’d suggest sticking to the AUR launcher. I’m not sure how you installed the other methods, but if they’re not using official Arch packages or the AUR, there’s risk of contaminating your system with un-tracked files that are hard to clean up.

Your friends suggestion to try using Proton to run the Windows version, is not a bad idea, but maybe keep that in the back pocket as the backup plan.

Are you able to launch minecraft-launcher from the command line, and monitor its output? It may provide a useful error.

Modrinth and Prism-Launcher have linux native flatpak versions

They’re probably going to be harder to debug, if they don’t simply work. But, you’re probably speaking to my concern about contaminating the system, in which case Flatpak’s are a good way of avoiding that, so :+1:

So i just tried your advice, i got the AUR launcher working and everything, same problem.
Also launching with the command doesn’t work.
(sh: row 1: command not found)
sh: Zeile 1: orca: Kommando nicht gefunden
Created browser window for reuse: 0x5e00004
[29652:29746:0501/063616.596670:ERROR:ffmpeg_common.cc(965)] Unsupported pixel format: -1
And then just “An unexpected issue occurred; we are sorry for the inconvenience. Please try restarting your Launcher”

In the AUR comments, this is a pinned comment with that error you’ve just shared:

wheat32 commented on 2025-03-09 05:32 (AEDT) (edited on 2025-03-09 06:30 (AEDT) by wheat32)

I seem to be having a different issue than what others are describing. Suddenly today, I an unable to start the launcher without getting a generic “An unexpected issue occurred” message. Here’s what I get in the terminal:

$ minecraft-launcher
sh: line 1: orca: command not found
Created browser window for reuse: 0x1600004 [34399:34552:0308/133050.212343:ERROR:mime_util_xdg.cc(137)] Invalid mime.cache file does not contain null prior to ALIAS_LIST_OFFSET=44
[34399:34552:0308/133055.416488:ERROR:cast_crl.cc(443)] CRL - Verification failed.

Edit: I found that deleting the webcache2 directory in the .minecraft directory fixes the issue for me.

Perhaps try what they’ve suggested?

I found that deleting the webcache2 directory in the .minecraft directory fixes the issue for me.

I did as suggested, the launcher started but no different console outcome or anything.
Same microslop, same broken ram, just more annoying ads.
I’ll probably stay with prism-launcher because it made no difference to download the official minecraft launcher, except that i now have more microslop stuff i don’t need.

So just confirming, there were no other messages presented to the command line when launching via minecraft-launcher that might be of value?

Also RAM usage growing isn’t necessarily indication of a memory leak, particularly if the game is actually doing something.

Correct me if I’m wrong, but I’m getting the impression that you’ve lost the appetite to troubleshoot the issue? It’d be good to let us know so we don’t misplace our time.

Nothing, not even anything which points in a useful direction.

And yeah, I did try for weeks on end now to find anything I can work with and at least for today I’m done. Idk if I’ll try again some day but it just seems hopeless.

I appreciate the help very much tho and thank you for your time.