How do I increase the heap size for Netbeans and any app run via Netbeans?
I'm trying to run a well-coded algorithm that tries to solve an NP-Hard problem via NetBeans but I'm running out of heap space.
Is the heap space I'm running out of specific to Netbeans? If so: how do I increase the heap space available to Netbeans?
Or is it specific to the app, as launched from Netbeans? If so: how do I tell Netbeans to launch it with more heap space?
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.