How do I increase the heap size for Netbeans and any app run via Netbeans?
As Ian C. says, the heap size is Application specific, therefore, here's how you increase it for Netbeans:


Right click on the NetBeans.app and select Show content of package.
Inside the package go to /Contents/Resources/NetBeans/etc/ and open the netbeans.conf file.
In the netbeans_default_options setting, change or add the following options: -J-Xmx... (e.g. -J-Xmx1600M) or -J-XX:MaxPermSize=... (e.g. -J-XX:MaxPermSize=500M). 
Save the file and restart the IDE.


If you want to increase the Project's heap size you must go to your project's Properties / Run / VM Options, and in the text box add the arguments.