Since Minecraft Java Edition was made using the Java programming language and uses it to function, often, you’ll be faced with definitions and words that don’t make sense to the average joe. One good example would be XMX, XMS, and XMN. What do they mean outside of the game when talking about Minecraft, and what are their best values?
XMX, XMS, and XMN are JVM – Java Virtual Machine parameters. These parameters tell Java how much RAM Minecraft should use when talking about Minecraft. Some launcher versions don’t even have the XMN argument anymore; the only one you should ever be changing is the XMX parameter.
It takes more than a three-sentence explanation to understand these arguments. It also takes a lot more to explain the best values for them, why you shouldn’t mess with some, why these values are the best, and what they mean. I’ll dig into all these problems and find an answer to them in the rest of this article.
What Are XMX, XMS, and XMN parameters?
To understand these parameters, we need to understand the language used in explaining what they are. I’m not tech-savvy, so I’ll try to explain in the easiest way possible so that even a five-year-old child can understand it (almost). First, let’s define what these parameters are
XMS – This parameter sets the initial size of the Java heap
XMX – This parameter specifies the maximum size to which the Java heap can grow
XMN – This parameter specifies the initial size of the Java heap for Eden generation
The first few questions that popped into my mind once I saw these explanations were what Java heap, Eden, and what values these parameters use. The first thing to know is that all of these parameters are used in a JVM, so what exactly is a JVM? Let’s find out.
JVM or Java Virtual Machine is a virtual (not physical) machine that enables computers to run Java programs. Thanks to the JVM, we can run Minecraft on our computers. JVM also interprets the Java programming language because it executes the programs written in Java. So, you write the code, and the JVM will interpret it and help it run precisely how you intended it.
To understand what heap size is, we need to understand what exactly heap is. Every Java object is stored in an area called the heap. It is created when the JVM starts up and can increase and decrease in size as an application runs. What exactly are these objects, though? Java is an object-oriented programming language, and everything in it is associated with objects and classes of these objects.
You’ll code objects and specify their classes, methods, and attributes. This is very abstract in its explanation, so the best way to explain it is by using, let’s say, a mobile phone. A mobile phone is an object, and this object has attributes like color, size, screen color, and weight. It also has methods which are what you can do with this phone. You can turn it on or off, play music, etc…
Eden is a place in Java where Java objects are created. So, when you create an object, it’s created in Eden. Eden is part of the heap since everything in Java is stored in it. Eden space can also get full, so these objects are removed to the garbage. So how does everything we discussed translate into Minecraft, and how do you change these values?
XMX best value
So, XMX will set the maximum RAM value that Java can allocate to Minecraft. When you give RAM in Minecraft, that set number isn’t constantly being equally used. Sometimes, it’ll take less, and sometimes it’ll take more. You can open the debug screen and check the value on the top right to see just how much RAM Minecraft is using at any given time.
It’ll be classified as Mem: and will feature three values. The first value shows how much memory the game is currently using. This value is also specified in percentages. The third value presents the maximum amount of memory the game can use.
You can change the value of XMX, but you can’t change its maximum value of it. The max value is preset. So, if you set the value of XMX to, let’s say, 6 GB, this will be the maximum amount of RAM the server can use if it ever needs it. If it’s not using it, that doesn’t mean that all is fine. To explain why we need to explain XMS.
XMS best value
XMS is the value you’ll set to determine the minimum amount of RAM the game uses. So, the discount will always be, let’s say, 1 GB, but in case the server is overloaded and needs more RAM, it can jump up to the set XMX value of 6 GB. Answering the best values for both is hard because it depends on many factors, but it’s best always to keep the importance of XMS and XMX the same.
That 3 GB difference, if you set the XMX to 6 GB and XMS to 3 GB, is bad. Mostly, this RAM will be unused, but it’ll always be on hold. Unused RAM is simply bad RAM, so make the values the same. So how much should you allocate?
These values are allocated on servers, so it depends on how many players are on your server, how many plugins and mods you’re running, and what you’re doing. An average-sized server that doesn’t have hundreds of plugins will run just fine if you allocate 8GB of RAM XMS and XMX if you’re using a dedicated machine to run the server.
If you’re using anything else on that machine, the operating system might get too little, which will cause the computer to lag, hence making your server lag as well. If you have a beast of a PC, 8GB should do the trick; if not, perhaps it’s best to lower the XMS by half and leave the XMX higher.
XMN best value
You wouldn’t want t mess with the best value of XMN. This value is set internally, but many people make it equal to XMX. Heap and Eden are the same, but heap moves the unused object to the old generation garbage, whereas Eden moves it to new generation garbage. Once Eden overflows, it’s moved to the old-generation garbage, and the process begins anew.
How to access and change these values?
To change these values in your Minecraft Launcher, you must go to the installations tab and edit installation settings for that version. Then, go down, choose more options, and find the area where it says something like xmx256m. You can change the numbered value in MB or in GB. For MBs, type in m after the numbered value, and for GB, put g after the numbered value.