Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NetBeans Low on Memory Error

Tags:

java

netbeans

I am new to this kind of error in Netbeans. I have been working in Java J2SE using my net beans 8.0.2. I am doing Fuzzy Search on Strings usually strings having 300-500 length. I am using Levenshtein and Jaro Winkler Algorithms to find the Distance between the strings. There are about 1500 iterations to find the distance between the strings! The problem is that my net beans often gives error for:

Low on Memory, Error Unable to Compile

I have done some search online to get rid of this error and found how to increase the heap size by adding

-Xms3G

command means to give 3GB space for the heap! but the error still comes up in the compilation process and project run in net beans.

Can somebody help me out how to get rid of this error because when it happen i got this error

 java.lang.noClassDefError

Please help me getting rid of this error I am a newbie for this error!

like image 891
Java Nerd Avatar asked Dec 24 '14 11:12

Java Nerd


1 Answers

With -Xms3G, it means that your JVM will be started with Xms amount of memory, the initial memory allocation.

But instead use -Xmx3G which will be able to use a maximum of Xmx amount of memory, the maximum memory allocation.

1.Netbeans Heap Size

If you want to increase the NetbeansIDE heap size, then edit the following file.(the etc folder from your Netbeans installation dir)

C:\Program Files\NetBeans\etc\netbeans.conf

Find the following line and add -J-Xmx3G, you can specify any size. I have provided 3G for eg.

netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-Xmx3G -J-XX:PermSize=32m ......."

2. Project settings for running a project by increasing Heap size from Netbeans

Right Click Project -> Properties -> Run -> VM Options -> Customize Button. You will find many options for VM, specify value for Xmx.

3. Run a jar file by providing VM options to increase heap size, outside of Netbeans.

Run form command line or write a script.

java -Xmx3G -jar filename.jar

Hope this may help.

like image 142
pmverma Avatar answered Oct 03 '22 13:10

pmverma