So this is a method wherein you Dedicate a partial of your RAM to your minecraft.
Step1:
Find out how much Random-Access Memory (RAM) you have.
How? http://windows.microsoft.com/en-ph/windows/how-much-computer-ram#1TC=windows-7 (http://windows.microsoft.com/en-ph/windows/how-much-computer-ram#1TC=windows-7)
Step2:
Run your launcher.
Step3:
Click Edit Profile.
Step4:
Tick JVM Arguments.
Step5:
Now that you've determined your RAM, you will decide how much of it you will dedicate to Minecraft.
Dedicate 1 Gigabyte = -Xmx1024M -Xms1024M
Dedicate 2 Gigabytes= -Xmx2048M -Xms2048M
Dedicate 3 Gigabytes= -Xmx4096M -Xms4096M
Dedicate 4 Gigabytes= -Xmx8192M -Xms8192M
Dedicate 5 Gigabytes= -Xmx16384M -Xms16384M
Dedicate 6 Gigabytes= -Xmx32768M -Xms32768M
Dedicate 7 Gigabytes= -Xmx65536M -Xms65536M
Step6:
Copy your code.
Step7:
Paste it in the JVM Arguments Text field. >Save Profile>Play.
If you get an error just try Dedicating 1GB of ram.