Open your startup script. There should be an option that says -Xmx1024M change the number to however many gigabytes you want to allocate multiplied by 1024. You may have to install 64-bit java to allocate more than x ram if you're using 32-bit. You should leave some ram for the system or else it may crash. I also suggest adding these option but it's not necessary.
-server -Xms1024M -Xmn512M -Xincgc -XX:UseSSE=4 -XX:+UseCMSCompactAtFullCollection -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -XX:+CMSIncrementalMode -XX:+CMSIncrementalPacing -XX:+UseCompressedOops -XX:+AggressiveOpts -XX:+CMSClassUnloadingEnabled
If you have a multi-core processor you can also add -XX
arallelGCThreads=1 with 1 being replaced by how many cores you want to allocate to the server. (Replace the '
' with a colon and a capital 'P')