开发者

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(Unkn开发者_JS百科own 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)


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜