The -J-Xmx... option tells the Java virtual machine the maximum amount of memory it should use for the heap. Placing a hard upper limit on this number means that the Java process cannot consume more memory than physical RAM available. This limit can be raised on systems with more memory. Current default value is 128MB. Note: Do not set this value to near or greater than the amount of physical RAM in your system or it will cause severe swapping during runtime.
~ details: https://performance.netbeans.org/howto/jvmswitches/
To set -Xmx option in Netbeans:
- Right click project, select Properties.
- Select Run tab, enter your setting in VM Options.
The option -Xmx1g request 1G of maximum memory for JVM. Run the example code in last post to varify.