-XINCGC -XMX(number of ram in MB)M
This will not only fix the Java running out of memory problem, but it will also make Minecraft run a lot faster.
I recommend using half of your ram, so your computer does not get slower because of Java.
This will work on Windows 7, Vista, and XP, you will just have to look harder. I don’t know if it will work on a Mac.