Take the 2-minute tour ×
Arqade is a question and answer site for passionate videogamers on all platforms. It's 100% free, no registration required.

There is a lot of lag when I play Minecraft, and I think it's due to the ram I've allocated currently. (495MB)

How do you allocate more RAM?

EDIT: I checked my other computer (Intel i5 Core)and it had the same amount of RAM allocated to minecraft. However, Minecraft did not lag on that computer.

After I installed Optifine on this computer, the lag stopped (I don't know why cause I read that Optifine splits the load onto 2 cores, but I have only one core (Atleast I think so, a sticker on the laptop says Intel CORE i7)).

Still looking for answers to this though.

share|improve this question
    
Here is a good optimization guide. Note that simply allocating more RAM may not always actually help. MineCraft can perform worse with too much RAM allocated - for example, it is recommended not to use more than 512MB for vanilla. The amount needed depends on the mods and texture packs you are using. –  mellamokb Jun 13 '13 at 16:06
1  
Core i7 can have between 2-6 cores, depending on the model, so Optifine should help allot. Also, this may not apply to you but I had a laptop which was really laggy for Minecraft and I realised I didn't have the best graphics drivers installed. I was using the default chipset, and not the Nvidia drivers. After installing the Nvidia drivers it worked amazingly. Make sure you have the drivers for the correct graphics card (Should be a sticker on your laptop next to the i7) –  ReallyGoodPie Jun 14 '13 at 11:15
    
@ReallyGoodPie Well that's strange, cause I checked device manager, and I have 8 cores. –  Meraj99 Jun 15 '13 at 6:01
    
I was just going off of wikipedia, which states that it has up to 6 cores. I thought i7 could have 8 cores, but assumed I had it wrong. –  ReallyGoodPie Jun 15 '13 at 6:05
1  
@ReallyGoodPie An Intel Core i7 has between 2-6 physical cores, which appear to the operating system as 4-12 logical cores through hyper-threading. –  Philipp Nov 11 '13 at 13:08

7 Answers 7

up vote 9 down vote accepted

Before you allocate RAM there are some things you should know:

  • x64 systems can allocate up to 192GB when using Windows Professional or above. 16GB when using Windows Home Premium and 8GB when using Home Premium and Starter. Also, please be aware of the physical limits imposed by your CPU Architecture.
  • x32 systems can allocate up to 1GB (This is from personal experience on a 8GB machine and a 3GB machine, please correct me if I'm wrong)

So it is recommended you have a x64 system to allocate as much RAM as possible. Try an leave at least 1GB for the general system processes and stuff like that.

Here is how you allocate RAM on a windows system:

  1. Create a new document and save it as run.bat
  2. type the following this is for 4GB:

    "c:\location to your javaw" -Xmx4096M -Xms2048M -jar "location.to.your.minecraft.exe"

So basically, the xmx is your maximum RAM your allocating and your xms is the minimum ram it should use.

Here is an example of an actual run.bat:

"C:\Program Files\java\bin\javaw.exe" -Xmx4096 -Xms2048 -jar "C:\users\user\Desktop\minecraft.exe"

Or if you have assigned Java in your system variables

javaw -Xmx4096 -Xms2048 -jar "C:\users\user\Desktop\minecraft.exe"

Obviously don't just copy my code, as you need to find out where A) Your javaw.exe is located and B) where your minecraft.exe

Remember: 1GB = 1024MB and 0.5GB = 512MB

NEW LAUNCHER [1.6+]

With the new launcher, it is allot easier to allocate RAM to your Minecraft. Simply go ahead and edit a profile and where it says "Java Settings (Advanced)", tick all the check boxes. Then add the amount of RAM you would like to the JVM Arguments text box. For example if I wanted to run it with 1GB I would simply type -Xmx1G and the 1G will indicate 1GB of RAM. xmx indicates the maximum RAM to allocate.

Profile Editor

Ensure that you have the correct path to your java and that you have JDK installed.

ALTERNATIVELY

Simply download the tekkit pack and there is an option to play vanilla Minecraft. Simply select the "Cog" or settings icon in the top right corner and it will give you an option to allocate RAM if other methods are failing. Good Luck

Also if you are having trouble doing any of this, just simply google it and there are literally 100s of posts similar to this and allot of tutorials.

share|improve this answer
    
Gives me invalid or corrupt jarfile minecraft.jar error –  Meraj99 Jun 13 '13 at 17:02
    
Have you tried the technic pack way? and are you using Windows, mac or a Linux Distro? Also, are you referencing a minecraft.exe or a minecraft.jar? Try to use a minecraft.exe for the purpose of this. –  ReallyGoodPie Jun 13 '13 at 22:02
    
Um, that's the error I get while opening my file. I'll try the technic way...... –  Meraj99 Jun 14 '13 at 6:46
    
I asked the questions so I could know why this is happening ^_^. Technic way should work no matter what though, if you have enough RAM –  ReallyGoodPie Jun 14 '13 at 11:11
    
@Meraj99 You may also want to check the amount of background processes and applications you have running on that computer. Try and close everything except Minecraft –  ReallyGoodPie Jun 15 '13 at 1:53

It is explained in full by this video (and the following text was found here with edits as found in the comments).

In essence this video denotes 3 main steps:

  1. Moving Minecraft to a folder. (Make sure this is the actual minecraft.exe and not a shortcut)

  2. Creating a text file using note pad, and write out (this example is for 2GB of RAM):

java -Xmx2048M -Xms1048M -jar “minecraft.exe” Note: If you are experiencing issues with this when running Windows 8 try deleting the quotation marks around Minecraft.exe. Alternatively, try and switch java to javaw instead. Credit to “Anon” in the comments!

  1. Save this file as a .bat and store it in the same file which you store Minecraft.exe.

Note: this example uses 2GB of RAM, for more or less RAM add intervals of 1024 for each additional GB.

share|improve this answer
    
I get a error, Unable to access jarfile %minecraft.bat –  Meraj99 Jun 13 '13 at 6:36
2  
Xms is the minimum memory to allocate to the program and Xmx is the maximum it is allowed to grow to. As such, these numbers being the same is not necessary and sometimes not a good idea. Try setting a range (e.g. -Xms1024m to -Xmx2048m). –  superdemongob Jun 13 '13 at 6:40
    
Now I have "Invalid or corrupt jarfile minecraft.jar" –  Meraj99 Jun 13 '13 at 6:43
2  
@Meraj99 did you remove the meta-inf (for mods)? then you need to add the main class net.minecraft.Minecraft –  ratchet freak Jun 13 '13 at 7:30
    
What's the net.minecraft.Minecraft thing.... –  Meraj99 Jun 13 '13 at 17:03

This is how my .bat file looks like in the MC folder:

start /high javaw -Xms2048m -Xmx4096m -jar minecraft.exe

If this gives you an error as well then you might want to download the java SDK, it gives more functionality.

Running the bat as administrator might help too.

share|improve this answer
    
Gives me invalid or corrupt jarfile minecraft.jar error –  Meraj99 Jun 13 '13 at 17:05
    
Did you install java SDK? If so try completely erase java from your PC and do a clean install. –  Menno Gouw Jun 13 '13 at 17:14
    
Eh, nope... still doesn't work. –  Meraj99 Jun 13 '13 at 17:40
    
Did you clear it completely and installed it from scratch? There was no trace in the registry not even when you reboot? Java can be very annoying to remove it leaves traces everywhere. Try searching for files. If i have some more time i try to find a good source online. This Issue MUST be your java. What do you get if yu just type "java" in the CMD? –  Menno Gouw Jun 13 '13 at 21:36
    
I get lots of things starting with "Usage:" –  Meraj99 Jun 14 '13 at 6:47
  1. Go to control panel
  2. Search Java
  3. Click on Java
  4. Click on Java at the top
  5. Click view
  6. You will see something like this: -Xmx2048m
  7. Click on that then backspace until it looks like this: -Xmx
  8. Now add your desired amount of RAM in Mb, then an m it should look something like -Xmx4096m (when you set it to 4GB)
share|improve this answer

Here's an example of direct optimization through .bat file

start javaw -Xms4096K -Xss128M -Xmx2048M -XX:PermSize=24m -XX:MaxPermSize=32m -XX:+UseParallelOldGC -XX:ParallelGCThreads=4 -XX:+CMSIncrementalPacing -XX:+AggressiveOpts -XX:+UseThreadPriorities -XX:+UseFastAccessorMethods -XX:+UseBiasedLocking -XX:+UseStringCache -XX:+TieredCompilation -XX:SurvivorRatio=8 -Dsun.java2d.noddraw=true -Dsun.java2d.d3d=false -Dsun.java2d.opengl=true -jar Spoutcraft-Launcher.jar

This one is for spoutcraft but you can just replace it on minecraft launcher's exe name and be done with it. If something goes wrong you can probably remove biased locking and string cache, along with tiered compilation and also setup parallelGCThreads to be equal your amount of cores.

share|improve this answer

Create a .bat file. This is how mine looks:

javaw -Xmx4096 -Xms2048 -jar "C:\Users\nope\Desktop\minecraft.exe"

(The reason why the nope is in there is that my computer's account name is "nope".)

The -Xmx4096 and -Xms2048 are what allocate more memory to Java (and therefore to Minecraft). Mine set the maximum to 4096MB (4GB) and the starting allocation to 2048MB (2GB), and you can allocate more or less by changing those numbers in the command.

share|improve this answer
    
Can you try and elaborate a bit? This is very unclear and doesn't really help as it currently is. –  shanodin Aug 11 '13 at 3:21
    
This just repeats what ReallyGoodPie's answer already says more clearly and in more detail. –  SevenSidedDie Aug 11 '13 at 6:44

It's worth noting at this point that as of version 1.6 and on the launcher has changed and there is now a new (arguably easier) way to allocate more memory to Minecraft.

You can do this by:

  1. Opening up the Minecraft launcher.
  2. Clicking the "Edit Profile..." button at the bottom left.
  3. Ticking the JVM Arguments box at the bottom of the menu.
  4. Changing the value of -Xmx1G, where 1G already equals 1GB of RAM.
share|improve this answer
2  
Please don't keep linking to outside sources. This smells like spam. If there's more information available, add it to your answer. That way, if that site ever goes down, your answer can still stand on it's own. –  Frank Nov 14 '13 at 21:46
2  
Hey TastySausage, having done some investigating I'm pretty sure that both minecraftman.com and the out-of-memory website are yours. It's actually OK to link to your own sites here but you must disclose your connection to the link for it to be OK. Doing otherwise, your posts will probably be deleted and you risk deletion of your account. You may have useful answers to contribute. If you wish to continue using Arqade, you should link to your site in your profile and disclose your conflict of interest in answers that use your site. Otherwise, we can assume you're just here for SEO. –  SevenSidedDie Nov 14 '13 at 22:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.