Problem in writing record to Berkeley DB

落爺英雄遲暮 提交于 2019-12-25 01:25:01

问题


when i am writing 1033 record then it write successfully but when i am writing 5,00,000 record the it give following error

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at java.util.regex.Pattern.compile(Unknown Source)
    at java.util.regex.Pattern.<init>(Unknown Source)
    at java.util.regex.Pattern.compile(Unknown Source)
    at java.lang.String.split(Unknown Source)
    at java.lang.String.split(Unknown Source)
    at WriteDataUsingCursor.main(WriteDataUsingCursor.java:31)

回答1:


The band-aid solution is to increase the heap size; see "How can I increase the JVM memory".


However, you may want to look into why your application is running out of memory. It may be keeping an in-memory of some or all of the data, and that may be the real cause of your problems. The general approach to tracking down this kind of problem is to use a memory profiler to figure our why it is using a lot of memory.




回答2:


i think you are having this problem because you are using an embedded database and those are normally used when you have a small number of values, i would suggest using sql server or oracle 11g if you need to enter alot of values



来源:https://stackoverflow.com/questions/6549610/problem-in-writing-record-to-berkeley-db

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!