So I'm playing minecraft modpacks through twitch launcher and I allocate around 8Gb of memory to it since my system has 16Gb of memory total. When playing, I have like 40fps or lower, I mean these modpacks are beefy, but so is my Pc. While I'm in-game, task manager shows low GPU and CPU usage, but memory usage is around 90%, so I imagine the bottleneck that causes lags is my memory, but why? I read up on modpacks before playing to see the recommended amount of memory allocation and do as instructed. Thats why I feel like the lag is not caused by insufficient amount of RAM allocated. If minecraft is only using up to 8Gb of memory, why is my memory usage almost at 90%? That means system is eating up the remaining 7-8 Gb? Why?
First, no MC modpack requires 8GB of memory allocated. That is too much. Java does not handle large of amounts of memory effectively.
Second, more memory does not mean better performance with Java. That is a myth.
I recommend 6GB allocated. That is what I use.
I would also check the amount of space available on the hard drive MC is installed on. If the HD is getting full, this can slow down the whole system.
I also recommend installing the latest version of Java on the PC then going into the Twitch Settings and ensure the app is using this version of Java. Also install 64-bit Java.
Rollback Post to RevisionRollBack
"We live on a placid island of ignorance in the midst of black seas of infinity, and it was not meant that we should voyage far."
To answer your last question, there is much more to memory usage in Java than what the Java program itself is using - the JVM itself (what runs the Java program) uses memory for its own uses, then add in memory used by native code outside of the JVM like OpenGL (especially if you have HD texture packs and/or shaders and/or a high render distance). This is precisely why you should never allocate more than half your free system RAM:
2. Why not give it more memory? Let's give Minecraft 4 GB of RAM to play with. This would need a PC with at least 8 GB RAM (as the real memory usage is almost double the memory visible in Java). If the VM decides to use all the memory, then it will increase the time between the garbage collections (20 sec instead of 4), but it will also increase the garbage collection time by 4, so every 20 seconds there will be one massive lag spike.
That aside, the memory consumption by modern modpacks is completely out of control as I often see reports of issues like this, even out of memory issues (native memory, not Java heap space. Otherwise, running out of free system RAM will cause paging, which is very slow even if you have a SSD) - I play on modded 1.6.4 with a measly 512 MB allocated and not even half of that is being used (though Task Manager shows upwards of 600 MB used by javaw.exe, which ties in with the above. I'd expect this relative overhead to be less with more Java heap allocated, on the other hand, the G1GC used by the default arguments needs more memory for internal bookkeeping than the CMS that I use, however, G1GC was designed for memory-intensive programs like Minecraft 1.8+). You could try optimization mods like FoamFix (for 1.14 or older) which claims to reduce memory usage by up to 50% (though any big modpack will probably already have it. Note that multiple optimization mods may not work well together).
Thanks for the advice, I tried experimenting by lowering the memory allocated. My java version is newest 64-bit aswell. On 8Gb allocation i get 40-50 fps, on 6Gb the fps drops down to 30. Minecraft is installed on SSD with more than 10Gb of free space left, and my computer is virus-free. With that said, I remember playing around in system settings as recommended by some random youtube tutorials on how to decrease memory usage or something, can't really remember, it was quite a while ago, though i recall it had to do something with superfetch. Memory is not limited in msconfig either. Its kind of hard to imagine that I can run like 99% of triple A title games on highest settings, while minecraft is being in that 1%. I definately have the hardware to run it, why can other people play the modpack even with lower specs is a question that leads me to think that there is a problem with something else regarding my system.
Update: I have been experimenting with a lot of things, but none of them seemed to help me. I reinstalled windows completely, booted up a modpack, it runs on 200+ fps. Thanks again for your help, it gave me some insight into this topic, well I'm off to enjoy some minecraft.
So I'm playing minecraft modpacks through twitch launcher and I allocate around 8Gb of memory to it since my system has 16Gb of memory total. When playing, I have like 40fps or lower, I mean these modpacks are beefy, but so is my Pc. While I'm in-game, task manager shows low GPU and CPU usage, but memory usage is around 90%, so I imagine the bottleneck that causes lags is my memory, but why? I read up on modpacks before playing to see the recommended amount of memory allocation and do as instructed. Thats why I feel like the lag is not caused by insufficient amount of RAM allocated. If minecraft is only using up to 8Gb of memory, why is my memory usage almost at 90%? That means system is eating up the remaining 7-8 Gb? Why?
First, no MC modpack requires 8GB of memory allocated. That is too much. Java does not handle large of amounts of memory effectively.
Second, more memory does not mean better performance with Java. That is a myth.
I recommend 6GB allocated. That is what I use.
I would also check the amount of space available on the hard drive MC is installed on. If the HD is getting full, this can slow down the whole system.
I also recommend installing the latest version of Java on the PC then going into the Twitch Settings and ensure the app is using this version of Java. Also install 64-bit Java.
"We live on a placid island of ignorance in the midst of black seas of infinity, and it was not meant that we should voyage far."
To answer your last question, there is much more to memory usage in Java than what the Java program itself is using - the JVM itself (what runs the Java program) uses memory for its own uses, then add in memory used by native code outside of the JVM like OpenGL (especially if you have HD texture packs and/or shaders and/or a high render distance). This is precisely why you should never allocate more than half your free system RAM:
That aside, the memory consumption by modern modpacks is completely out of control as I often see reports of issues like this, even out of memory issues (native memory, not Java heap space. Otherwise, running out of free system RAM will cause paging, which is very slow even if you have a SSD) - I play on modded 1.6.4 with a measly 512 MB allocated and not even half of that is being used (though Task Manager shows upwards of 600 MB used by javaw.exe, which ties in with the above. I'd expect this relative overhead to be less with more Java heap allocated, on the other hand, the G1GC used by the default arguments needs more memory for internal bookkeeping than the CMS that I use, however, G1GC was designed for memory-intensive programs like Minecraft 1.8+). You could try optimization mods like FoamFix (for 1.14 or older) which claims to reduce memory usage by up to 50% (though any big modpack will probably already have it. Note that multiple optimization mods may not work well together).
TheMasterCaver's First World - possibly the most caved-out world in Minecraft history - includes world download.
TheMasterCaver's World - my own version of Minecraft largely based on my views of how the game should have evolved since 1.6.4.
Why do I still play in 1.6.4?
Thanks for the advice, I tried experimenting by lowering the memory allocated. My java version is newest 64-bit aswell. On 8Gb allocation i get 40-50 fps, on 6Gb the fps drops down to 30. Minecraft is installed on SSD with more than 10Gb of free space left, and my computer is virus-free. With that said, I remember playing around in system settings as recommended by some random youtube tutorials on how to decrease memory usage or something, can't really remember, it was quite a while ago, though i recall it had to do something with superfetch. Memory is not limited in msconfig either. Its kind of hard to imagine that I can run like 99% of triple A title games on highest settings, while minecraft is being in that 1%. I definately have the hardware to run it, why can other people play the modpack even with lower specs is a question that leads me to think that there is a problem with something else regarding my system.
Update: I have been experimenting with a lot of things, but none of them seemed to help me. I reinstalled windows completely, booted up a modpack, it runs on 200+ fps. Thanks again for your help, it gave me some insight into this topic, well I'm off to enjoy some minecraft.