How to change the VM heap space in a Netbeans Platform project

6

I'm having the following problem:

I have a Netbeans Platform Application project that during execution the application hangs once and nothing else responds (one minute execution is enough to crash, this possibly occurs because of large queries that application needs to do). And this problem occurs in a ratio of 2 times in every 10 executions.

When the problem occurs the NetBeans output does not catch any error, however, in the installed version of the project I was able to catch the following error: OutOfMemoryError: Java heap space

Well, I saw in this topic the suggestion to change VM options. However as the project is a Netbeans Platform Application , I have not found VM options in properties.

In another topic of the English version of the site, I saw the suggestion to add the run.args.extra=-J-Xmx1024m excerpt property in the project.properties file, but apparently this property seems to be ignored and the problem still occurs.

Does anyone know how I can change the VM settings in a Netbeans Platform Application ?

    
asked by anonymous 23.06.2015 / 17:35

1 answer

2

My suggestion is to modify directly in the netbeans configuration file:

netbeans.conf

You can find it in:

  

global install:    $ {nb-install} /etc/netbeans.conf

     

or

     

user local: $ {userdir} /etc/netbeans.conf

Look for the item: netbeans_default_options

# Options used by NetBeans launcher by default:
# (can be overridden by explicit command line switches)
#
# Note that default -Xmx and -XX:MaxPermSize are selected for you automatically.
# You can find these values in var/log/messages.log file in your userdir.
# The automatically selected value can be overridden by specifying -J-Xmx or
# -J-XX:MaxPermSize= here or on the command line.
#
# If you specify the heap size explicitly, you may also want to enable
# Concurrent Mark & Sweep garbage collector.
# (see http://wiki.netbeans.org/FaqGCPauses)
#


netbeans_default_options="-J-Xms1536m -J-Xmx2048m  ... outras opções ..."

In the example I added:

  • Initial heap = Xms
  • max heap = Xmx
24.06.2015 / 23:01