0

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)
aHSANaLI
  • 49
  • 1
  • 8
  • Increase heap size? Google is your friend http://tinyurl.com/6g3gvx9 – Kal Jul 01 '11 at 15:24
  • 1
    possible duplicate of [Problem in writing record to Berkeley DB](http://stackoverflow.com/questions/6549610/problem-in-writing-record-to-berkeley-db) .... asked a few minutes ago. – Stephen C Jul 01 '11 at 15:29

1 Answers1

1

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.

Jason Day
  • 8,809
  • 1
  • 41
  • 46