I am trying to build a lexicon trie of almost 110000 words in java in netbeans. My code is running fine but it gives an Exception as follows:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOfRange(Arrays.java:3209) at java.lang.String.<init>(String.java:215) at java.nio.HeapCharBuffer.toString(HeapCharBuffer.java:542) at java.nio.CharBuffer.toString(CharBuffer.java:1157) at java.util.regex.Matcher.toMatchResult(Matcher.java:232) at java.util.Scanner.match(Scanner.java:1270) at java.util.Scanner.nextLine(Scanner.java:1517) at lexiconbuild.model.Lexicon.<init>(Lexicon.java:29) at lexiconbuild.model.LexiconBuild.main(LexiconBuild.java:17) Java Result: 1
I was wondering if someone could help me with increasing the java heap space in netbeans.
To increase the Application Server JVM heap sizeNavigate to the JVM options. Edit the -Xmx256m option. This option sets the JVM heap size. Set the -Xmx256m option to a higher value, such as Xmx1024m.
1)Change the gradle. properties file and change the heap size as per your requirement. 2)"Edit Custom VM Options" from the Help menu.
A medium-sized project currently open in NetBeans is consuming about 184 MB of memory on this machine, with peaks noticeably higher while compiling. As with any advanced design tool, NetBeans will always cheerfully accept more hardware resources and perform better for having them.
You can set it in NetBeans in the project properties -> Run -> VM options
Example: Putting -Xmx512m in the "VM Options" text box gives 512Mb maximum heap size to your Java program.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With