I found this in http://osdir.com/ml/linux-kernel/2009-10/msg03503.html
If application does mlockall(MCL_FUTURE) it is no longer possible to mmap file bigger than main memory or allocate big area of anonymous memory in a thread safe manner. Sometimes it is desirable to lock everything related to program execution into memory, but still be able to mmap big file or allocate huge amount of memory and allow OS to swap them on demand. MAP_UNLOCKED allows to do that if mmap method use MAP_UNLOCKED flag, this can expain everything. Is that right? -----邮件原件----- 发件人: Uwe Schindler [mailto:u...@thetaphi.de] 发送时间: 2010年1月30日 16:47 收件人: java-user@lucene.apache.org 主题: RE: MMapDirectory need twice more virtual memory than actually need? MMapDirectory should only be used on 64bit machines with 64bit JVMs. This is described in the Javadocs. The additional sizes are caused by reopens and have their reason in specialties with the Java VM, described in 2.9/3.0 Javadocs of the class, please take a look. You can also enable a workaround for the missing “unmap” call. ----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen <http://www.thetaphi.de/> http://www.thetaphi.de eMail: u...@thetaphi.de From: luocanrao [mailto:luocan19826...@sohu.com] Sent: Saturday, January 30, 2010 8:31 AM To: java-user@lucene.apache.org Subject: MMapDirectory need twice more virtual memory than actually need? Environment: 64 bit linux,memory 8G When I used pmap instruction to see virtual memory, I found two big anon memory which grows with the index file size. I had the two following pictures to show the problem, can you explain? This is why I got out of memory exception in 32 bit machine. Because my index file size is only 800m. Anon memory picture Indexfile memory picture --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org