aHSANaLI
aHSANaLI

Reputation: 49

how to increase heap size of java cache memory

I'm using berkeley db java edition (Base api) to insert 5 lack rows to db database I already inserted 1000 rows in 200 ms bt i m getting problem in inserting 5 lack rows so i think there is something some paramaeter to set in EnvironmentConfig class or dbconfig class

error like:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOfRange(Unknown Source)
    at java.lang.String.<init>(Unknown Source)
    at java.io.BufferedReader.readLine(Unknown Source)
    at java.io.BufferedReader.readLine(Unknown Source)
    at WriteDataBase.main(WriteDataBase.java:29)

Upvotes: 0

Views: 2613

Answers (1)

Jason Day
Jason Day

Reputation: 8839

You just need to increase the maximum heap size of your JVM. Add -Xmx512m to your startup options. For example, if your application is in a jar file:

java -Xmx512m -jar yourjarfile.jar

Or if you are executing the class directly:

java -Xmx512m com.whatever.YourClassName

The 512m means to set a maximum heap size of 512 Megabytes. That may be too big or too little, depending on your application, so you will need to experiment.

Upvotes: 1

Related Questions