[ATM3 v5.6] Memory Leak (?) | Using more RAM than allocated
EpiclyDelicious opened this issue ยท 8 comments
Issue #318 discussed this issue in 5.4, but the user never responded on their findings.
I can confirm, at least on my end, that I am experiencing the same issue... And it is incredibly frustrating.
I have downloaded a fresh ATM3 v5.6 modpack several times and tried tons of different JVM arguments to find a solution. I am using Java 8 152 64-bit. I have set Twitch Launcher to use 5GB, 6GB, and 8GB as the max. I can load the modpack with 5GB, but once I LOAD a world it instantly jumps to 8-10GB RAM usage. The same happens for any other amount of RAM, no matter what JVM arguments I set.
I have tried setting minimum JVM arguments equal to the maximum. I have tried using a server to connect to (it's on a separate machine with 12GB of RAM).
Initially I was just loading SP worlds, but there's that weird issue where I get stuck at 'Loading World - Generating Terrain' until I delete the advRocketry folder in the save folder. I noticed before I deleted the folder and sat there in the stuck loading screen... that I had Minecraft's max RAM allocation at 5GB. It went to 6GB before just sitting there. Just loading the modpack when on 5GB max it still goes up to almost 6GB.
After deleting the advRocketry folder, the world loaded successfully and instantly jumped to 9-10GB RAM usage... I am at a loss as to what is causing this.
EDIT:
PC Specs:
- CPU: AMD Ryzen 7 1700 3.0GHz
- MOBO: Gigabyte GA-AX370-GAMING 5 ATX AM4 Socket
- RAM: Corsair Vengeance RGB 16GB (2 x 8GB) DDR4-3200
- GPU: AMD Radeon Sapphire R9 Fury 4GB NITRO
- SSD: ADATA Ultimate SU800 512GB 2.5"
- HDD: Seagate Barracuda 2TB 3.5" 7200RPM
Software:
- JAVA: Java 8 - Update 152 (64-bit)
- Twitch Launcher (Latest Version); Using Native Launcher
- ATM3 v5.6
I can provide some logs for you if you wish, but lemme know which ones you need. (I've checked them myself and didn't see anything outstanding, but I'm not sure what to look for)
Another thing to note is I tried vanilla MC with no mods and only forge. It used about 3GB in Task Manager, but not that much in-game. That's the issue we're having. When I'm in-game ATM3 uses like 4GB roughly when using the F3 statistics. Task Manager says otherwise.
can confirm a memory leak, but in my case it happens every time after a few hours playing. it freezes my whole pc.
So while using VisualVM and some more testing I found some very odd results, which I am not entirely sure how to fix.
This first image shows what happened after being idle in an SP world for 15+ minutes. The max heap was up in the 10-11GB range as usual when I loaded into the world. I came back after helping a friend with something and..... it magically went back down to the actual allocated max heap? I left it sitting there. I honestly do not understand why this occurred. It seems like something is snatching onto as much of my memory as possible, not letting go, but eventually releasing it? I've yet to replicate this...
This next image shows that it indeed was using around 10GB max heap for whatever reason. This specific image is also from me trying to simply log into the server instead of a SP world. I couldn't even login. The server just times me out/disconnects me and I have to end the Java process manually.
What makes this even more confusing is I had my two friends with 8GB of RAM try out the same modpack and they had no issues running SP worlds. They both have Intel systems (could be a possible culprit as I have AMD/Ryzen?) and reported low-ish RAM usage in Task Manager.
From the second image, when I instantly monitor the Minecraft process I notice that the Max heap size instantly goes to ~10GB. There's no gradual curve or anything.
EDIT: I am very confused now. I was doing more testing seeing if it was a memory leak from mods. Took some away one by one. The 'max' heap size stopped being ~10GB. I added the mod(s) back one by one to confirm which one it was. The 'max' heap size didn't go back up to 10GB. It's at ~5GB, which is what I have set in the Twitch Launcher. While doing one by one, I simply ended the Java process manually before Minecraft could even load. VisualVM is now displaying the proper 'Max' Heap size now.. for whatever reason. But when I load a SP world or try to login to a server my RAM usage skyrockets still.
Part of the problem is that task manager is reporting how much the entire java.exe process is using, which is independent of the JVM (or multiple JVMs) that it might have active at any given time.
First I'd say change the launch method in twitch minecraft settings to "use jar launcher" and for the java versions instead of use latest, open the dropdown and actually pick java 152
Then re-launch and observe again.
If things still seem off to you, download VisualVM and attach to the minecraft java process, it will give in-depth details / charts of how much RAM the VM itsself (not the entire java process) is using and when garbage collection runs, etc.
I have a strong suspicion this is just Windows doing system-level automatic memory management and just because task manager shows it's high doesn't mean it's being "locked" either. The result is maybe leading to you perceiving an issue when maybe there isn't one? At any rate, VisualVM will have a much more detailed breakdown
Yea I did a bunch of research into how Java allocates/uses memory for the (multiple) JVMs. The issue I found is like you stated; it's independent of the actual 'game'. I found that the -Xmx argument is simply for heap space, but not the overall pool/virtual memory allocation. (Still learning terminology there)
I've already tried using the 'jar launcher' once before, but I'll try once again to observe any changes in behavior. I also read about the VisualVM thing and I'll definitely download that to take a look further.
I also had a sneaking suspicion this could be Windows being... Windows. I had never had this issue before when using modpacks, especially when creating custom ones. I made a custom modpack that had even less mods than ATM3 (but did include a few 'heavier' mods I suppose) and it actually got up to 11GB RAM usage. Hence why I moved to ATM3 for a more 'stable' modpack.
Due to processes adding up over time, the custom modpack actually pinged my RAM out at 98% of 16GB... which is about the time the hard drive starts getting involved and that's not good. Luckily ATM3 only got up to around 9GB.
Thanks for the suggestions though. I'll report back with any findings!
Can I get a gist of your latest.log
, fml-junk-earlystartup.log
, and fml-client-latest.log
(all of whichever ones you do have)
Also, if you can recreate the situation where max heap is up in the ~10gb range while in-game, hold F3+C for ~10 seconds to force a crash and share that crash-log
as well, please.
latest log - https://gist.github.com/MafooHamhead/920feb75b51e97411bf391ab237e5927
client crash - https://gist.github.com/MafooHamhead/d2ccbfdff3815edaeb2760916e81f4cb
Only two I have. I wasn't able to replicate the 10-11GB issue. When in the ATM3 SP world/server world I was more so in the 8-9GB range this time. Let me know if I can provide anything else!