Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.OutOfMemoryError: Map failed #105

Closed
duthchao opened this issue Sep 29, 2014 · 3 comments
Closed

java.lang.OutOfMemoryError: Map failed #105

duthchao opened this issue Sep 29, 2014 · 3 comments

Comments

@duthchao
Copy link

Recently,I am creating an index for a lot of articles. I prefer to use BTree<String,HashSet> to store articles.When the btree's enties is up to 200000,my program stopped with the java.lang.OutOfMemoryError: Map failed-------exception.
Here is the stacktrace:
Caused by: java.io.IOException: Map failed
at sun.nio.ch.FileChannelImpl.map(Unknown Source)
at org.apache.jdbm.StorageDiskMapped.write(StorageDiskMapped.java:113)
at org.apache.jdbm.PageFile.synch(PageFile.java:363)
at org.apache.jdbm.PageTransactionManager.synchronizePages(PageTransactionManager.java:178)
at org.apache.jdbm.PageTransactionManager.synchronizeLogFromMemory(PageTransactionManager.java:121)
at org.apache.jdbm.PageTransactionManager.start(PageTransactionManager.java:221)
at org.apache.jdbm.PageFile.commit(PageFile.java:240)
at org.apache.jdbm.PageManager.commit(PageManager.java:204)
at org.apache.jdbm.DBStore.commit(DBStore.java:446)
my computer 's memory size is 2GB ,os is win7. My DB's set is DBAbstract db1 = (DBAbstract)DBMaker.openFile("E:\新生训练\docs\db1").make();

To solve OOME mapflied ,how to set the DB?

@duthchao
Copy link
Author

i am sorry for my pour english.Thanks to JDBM3,it really helps me a lot. but for now. the :
java.lang.OutOfMemoryError: Map failed
at sun.nio.ch.FileChannelImpl.map0(Native Method)
This problem will drive me mad! I can't expand my computer's memory,nor the win 7 os.I think changing DBMaker set will help somehow. In addition,the entry's Data Structure which inserted into BTree is Entry<String,HashSet>. The total number of entries is about 520000.

@jankotek
Copy link
Owner

jankotek commented Oct 1, 2014

JDBM3 is unsupported. Please move to MapDB.

Two ideas:

  • HashSet[String] value must be immutable. So do not add new elements to hash set if it is already in BTree
    • at sun.nio.ch.FileChannelImpl.map0(Native Method) Memory mapped files are limited to 2GB on 32bit systems. So use 64bit, or use slower RAF files.

@jankotek jankotek closed this as completed Oct 1, 2014
@duthchao
Copy link
Author

duthchao commented Oct 1, 2014

Thank you for sparing a time to reply me.RAF files did help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants