How to increase Java's virtual memory? (for Minecraft :D )?

I just updated Minecraft to 1.3.1, and suddenly i'm getting the ol' "Minecraft has run out of memory" error message. I've never had this problem before so I'm assuming it's because the LAN server feature that was added takes up a lot of RAM. I remember seeing some way to increase the memory allocation for Java when i was reading about the LB Photo Realism texture pack a while ago, but i didn't do anything with it because i didn't think I'd evr need it. I know my PC can handle it, it has 8 GB of RAM and there's NO WAY Minecraft will use that much.
So, How do I increase the virtual memory limit on Java?

Starryn2012-08-02T20:42:47Z

Favorite Answer

2 methods:

1)

-Go to your computer's control panel
-Select "Java"
-Select the "java" tab
-Click "view"
-In the box marked "Runtime Parameters" insert "-Xmx512M" and select ok

2)

-Go to task manager (ctrl+alt+delete)
-Right click on "java.exe" or "javaw.exe" (whichever one it is) and set priority to high

Anonymous2016-10-29T06:49:32Z

Java Virtual Memory