An exception in the thread "main" java.lang.OutOfMemoryError, how to find and fix?

I am trying to program a crossword puzzle creator. using this txt text file and this template txt file. The basic idea is to use the DFS algorithm. The problem starts when the dictionary file is very large (about 50,000 words). then I get:

Exception in thread "main" java.lang.OutOfMemoryError: GC upper limit exceeded

I know that there is a part in my program that takes up memory, but I don’t know where it is, how to find it or how to fix it.

+3
source share
5 answers

? , JVM ( JVM - ).

.

$ java -Xmx512m ....

JVM 512 .

, ( - ), , YourKit . , , .

+3

( linux based os)

1) ( ) "domain.xml"

/GlassFish//domain1/

<jvm-options>-XX:MaxPermSize=

set it to higher value eg- 198m or 256m

2) , , (, 8686).   ( linux based os) -

sudo netstat -npl | grep 8686

- .

tcp6 0 0 :::8686 :::* LISTEN 3452/java

kill -9 3452, (3452 )

, .

+2

, , ,

While(condition){

    String s="tttt";

}

, .

0

. , . - ( - ). , G1.

, , ( , , ). , , , , .

0

big dictionary ... mmm .. is there an absolute requirement to store this directly in jvm's memory?

Such a lazy guy like me would have saved it in a database (for example, in memory - for example, hypersonic), transferred responsibility for searching the list to the database while my program was working on creating an interesting symmetrical black and white square combination :)

Just a thought.

0
source

Source: https://habr.com/ru/post/1748750/


All Articles