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

2 emeralds7 replies96 views
created 06/18/2019 1:44 pm by Debux
last reply 06/20/2019 2:05 am
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:

Here are my Minecraft settings:
Posted by avatar
Level 3 : Apprentice Explorer

comment Login or register to post a reply.

7 replies

06/20/2019 2:05 am
Level 17 : Journeyman Nerd
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.
06/20/2019 12:33 am
Level 20 : Expert Skinner
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
06/20/2019 12:36 am
Level 6 : Apprentice Engineer
Isn't -Xms heap size?
06/20/2019 12:58 amhistory
Level 20 : Expert Skinner
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).
06/20/2019 1:18 am
Level 6 : Apprentice Engineer
Why is -Xms needed? Can't we just have a limit, without a minimum? Or does Java need a minimum to fulfill first?
06/20/2019 1:52 am
Level 20 : Expert Skinner
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.
06/19/2019 11:06 pm
Level 34 : Artisan Artist
How many Ram do you have? Do you have system x64?

Planet Minecraft



© 2010 - 2019