Wednesday, January 20, 2010

Increasing Memory For Servers in Netbeans 6.8

A frequent problem that developers working with Java web applications face is running out of heapspace while testing their applications. This is mainly due to the fact that the amount of heap memory reserved by the JVM for the application is quickly consumed by repeated undeploy/deploy cycles. The onmly work around that I know to date is to increase the available heap space. This gives you at least temporary relief since you are only postponing the inevitable out of memory error.

In Netbeans 6.8 it is very simple to increase the memory available for a server.

Step1.
On the Services tab expand the Servers node. Right click on the name of the server that you are using and select Properties.


Figure 1: Selecting Server Properties Window

Step 2
Select the Platform tab and enter the following under VM Options:

-Xms512M -Xmx512M

These options specify that there will be a minimum of 512 MB available for the server and a maximum of 512 MB available. You can of course use different numbers to suit your needs. Other VM Options can be found here.


Figure 2: The VM OPtions for the Server

Now you need to restart the server for the settings to take effect.



No comments: