How to set java heap size in NetBeans?

Open the configuration file etc/netbeans.conf (in the directory where NetBeans is installed) in a text editor and modify the options in netbeans_default_options setting. You can change or add following options: -J-Xmx... (e.g. -J-Xmx256m) or -J-XX:MaxPermSize=... (e.g. -J-XX:MaxPermSize=96m). Save the file and restart the IDE.
Bear in mind that UI responsiveness may be affected when the heap utilization gets close to its limit. Should you encounter an OutOfMemoryError, you need to increase Xmx or XX:MaxPermSize back to the default, or even higher.
NetBeans 6.x
Since NetBeans version 6.0, the default limit for heap size (-J-Xmx) is determined automatically, with respect to the amount of memory available on the system. There is no -J-Xmx option specified in netbeans.conf. However, if you specify the heap size limit (i.e. you add the -J-Xmx... option to netbeans.conf), then the limit given by you will be respected.
Similarly when running on a machine with more memory it might be useful to increase the maximum size of the heap, especially when working with larger projects.

No comments:

Post a Comment

Please Provide your feedback here