Let's be honest: I only use Java for Minecraft. So I only debugged with it. But all version, server or client, all launchers. All of them use double (or more) RAM. In the game the correctly allocated amount is used, but on my system double or more is allocated. Thus my other apps don't get enough memory, causing crashes, while the game is suffering as well.
I'm not wise enough to know what logs or versions or whatever I should post here as a cry for help, but I'll update this with anything that'll help, just tell me. I have no idea how to approach the problem. One idea I have is to run a non-Minecraft java application, but who has( or knows about) one of those?
@jrgd@lemm.ee's request:
launch arguments [-Xms512m, -Xmx1096m, -Duser.language=en] (it's this little, so that the difference shows clearly. I have a modpack that I give 8gb to and uses way more as well. iirc around 12)
game version 1.18.2
total system memory 32gb
memory used by the game
I'm using KDE's default system monitor, but here's Btop as well:
this test was on max render distance, with 1gb of ram, it crashed ofc, but it crashed at almost 4gbs, what the hell! That's 4 times as much
I'm on arch (btw) (sry)
Modded Minecraft is memory hungry. Even normal Minecraft can be. I've seen people suggest alternative JVMs (open j9) because they supposedly garbage collect more aggressively before requesting more memory. I tried this once with Forge back when it had to patch everything when it began (maybe still the case, idk) and what it actually did was just make everything slow to a crawl because the JVM wanted to collect instead of allocate more and keep going.
File bug reports with mid authors and Mojang of it is using way more memory than they say it needs so they update their docs but this is pretty much par for the course.
Think about it like this. You have a table. You have papers. You're doing complicated math. You can use more and more of the table for scratch work on your papers. At some point you run out of table space. You consolidate the papers and notes you've taken on them. But that's time you could've been doing more "useful" work. Now, what if you had like 90% of the table still full once you did that? You'd honestly need more table.
Minecraft is a great game, but when you push it to the extremes it has difficulty keeping up.
Thanks for the info. Bit sad to know this is the case, but makes sense. Also thanks for discouraging trying other GCs. Spared me a bit of time. I know sometimes it's a good idea, but it's logical that it's at the cost of performance.