2

[Help] Minecraft won't allocate more than 4GB of RAM.

Debux's Avatar Debux6/18/19 1:44 pm
2 emeralds 1.9k 7
6/20/2019 2:05 am
logan2971's Avatar logan2971
Hello recently I have been encountering random lag spikes due to insufficient amount of allocated ram.
I have tried changing my ram up to 6gb however nothing changed; my minecraft still had 4gb ram allocated.

I tried:
changing runtime parameters in java settings.
changing the java from bundled to installed.

Here is the list of mods:
https://gyazo.com/c9912dcc2e0fa07dc3ed8231f9ed3980

Here are my Minecraft settings:
https://gyazo.com/c5a1eae57c76a2cc1855940cc844e5ee
Posted by Debux's Avatar
Debux
Level 2 : Apprentice Explorer
1

Create an account or sign in to comment.

7

1
06/20/2019 2:05 am
Level 23 : Expert Nerd
logan2971
logan2971's Avatar
If you have a 64-bit operating system a very simple solution could be that you have downloaded a 32-bit version of java. Try to download the 64-bit version.
2
06/20/2019 12:33 am
Level 46 : Master Skinner
R_Ryan
R_Ryan's Avatar
First of all, do you have a 64 bit operating system? Older 32 bit systems are capped at 4 gigs no matter what.



if you are running 64 bit, It's hard to tell from the screenshot you posted, but it looks like you've set your arguments to use 6 gigabytes MAX, not minimum.




Try the following:


-XX:+UseG1GC -Xmx6G -Xms6G -Dsun.rmi.dgc.server.gcInterval=2147483646 -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M
2
06/20/2019 12:36 am
Level 33 : Artisan Engineer
WhoAteMyButter
WhoAteMyButter's Avatar
Isn't -Xms heap size?
1
06/20/2019 12:58 amhistory
Level 46 : Master Skinner
R_Ryan
R_Ryan's Avatar
Yes, -xms is initial and minimum heap size, -xmx is maximum heap size.



For those who don't know, the "heap" is a pool of available random access memory that is shared by all running threads in the Java virtual machine.



In other words, when you fire up minecraft, the Java virtual machine "asks" the operating system to set aside a certain amount of ram to keep available for minecraft to use. By default, minecraft only asks for 256 Megabytes (nowhere near enough), and then asks for more as needed, but is capped at no more than 2 gigabytes (still not really enough on most modern systems).
2
06/20/2019 1:18 am
Level 33 : Artisan Engineer
WhoAteMyButter
WhoAteMyButter's Avatar
Why is -Xms needed? Can't we just have a limit, without a minimum? Or does Java need a minimum to fulfill first?
1
06/20/2019 1:52 am
Level 46 : Master Skinner
R_Ryan
R_Ryan's Avatar
It has more to do with the operating system than with MC. -Xmx doesn't allocate ram, rather it gives the JVM permission to ask the OS to allocate RAM as needed. If the JVM doesn't perceive more ram as necessary, it won't ask for more, or if that RAM is unavailable for whatever reason (maybe windows decided to start downloading updates in the background), the OS might deny future requests.




Asking for all the RAM you want up front ensures that no other background processes can start using it up after you've started the game, and it allows the JVM to more aggressively use up that ram without its memory management algorithms restraining it.





Alternatively, the game may crash on launch due to not getting permission to allocate all that ram at once which is a valuable bit of information for troubleshooting purposes. If your system SHOULD have that much ram to ask for, and you can't use it, there's a bigger underlying problem. Worst case, it's a bad RAM chip.




Also, it's less noticeable (maybe 5 fps max) but setting min and max to the same value stops your CPU from having to constantly resize the heap to try and keep up. That makes garbage collection a bit easier and faster too. You do all of your OS level allocations when JVM starts, and you just don't release it until JVM closes.
1
06/19/2019 11:06 pm
Level 53 : Grandmaster Artist
MaTheLuanNotYT
MaTheLuanNotYT's Avatar
How many Ram do you have? Do you have system x64?
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome