Out of memory

This error occurs when the game does not have enough memory to continue.

Essentially, Minecraft crashes when the amount of memory that it is using is more than is available to it. This can be caused by either Minecraft taking up much too memory because of having too many processes going on, or it just doesn't have the memory to continue.

How much memory do I have?

Every computer has a set amount of memory, or "RAM". In order to troubleshoot this error, we must first find out how much "RAM" you actually have, as you can't give the game more than you have! 

Depending on your operating system, these instructions will vary.

If you are on Windows - Press your Windows + R keys, to bring up a run dialogue, in it, type in: "cmd", and hit enter. This will bring up a command prompt window. In the Command Prompt window, type in:  systeminfo | find "Total Physical Memory". Once you have done so, give it a minute to gather the info, and you should be presented with a number in MB, keep that handy.

If you are on Mac OSX - Apple has made a nice tutorial which explains how to collect statistics on the amount of memory you have, which can be found here.

If you are on Linux - Open a terminal window, and type in: free

Once you have found this, you can continue!

Do I have the proper Java installation?

Minecraft, runs on a platform called Java. Java comes in many shapes, and forms, which may make it confusing exactly which version of it you should have installed, which is what this should hopefully explain.

First, we want to find out our OS's processor architecture. 

If you are on Windows - Press your Windows + R keys, to bring up a run dialogue, in it, type in: "cmd", and hit enter. This will bring up a command prompt window. In the window, type in: echo %processor_architecture% then hit enter. If the output was amd64, you have a 64-bit OS. If the output was x86, you have a 32-bit OS.

If you are on Mac OSX - You have a 64-bit OS. If you're running OS X 10.6.8 and below, stop here and use  to update Java instead. Otherwise, you can continue.

If you are on Linux - Type this command in a terminal window:  less /proc/cpuinfo.

Now that we have that,  look at the diagram below, and download the proper Java version for your OS and processor architecture. If you are prompted that said version of Java is already installed, please uninstall your current version of Java and redo this step. 

# 32 bit OS 64 bit OS
Windows jre-7u45-windows-i586.exe jre-7u45-windows-x64.exe
Mac OSX jre-7u45-macosx-x64.dmg
Linux jre-7u45-linux-i586.rpm jre-7u45-linux-x64.rpm

Once you have installed the proper Java version, you should give the game a go!

Still not working?

Once you have done the above, and you continue to receive out of memory errors, then you may need to physically give the game more memory*. To approach, you previously collected the amount of memory you have. Now, to allocate memory to the game, pick an amount of RAM that is more than 1024MB or 1G, but less than the total amount of RAM you have on your computer. For example, "2048MB" or "2G".

* NOTE: On 32-bit Windows Java installations, you can only allocate up to 1.5G of RAM! 

To allocate more RAM, launch the game, and press the "Edit Profile" button at the bottom left. There should be a check box called "JVM arguments", check that and input: -Xmx2G to give 2GB to the game, or -Xmx2560M to give 2560MB. Once you have checked and inputted the data, hit "Save Profile".

Once you have done so, attempt to login to the game!

Mojira Link: MC-3256 - Memory leak when starting large TNT chain reactions