I have been putting my entire index into memory using RAMDirectory
to improve performance and it worked beautifully until my index grew and grew. Now I am getting OutOfMemoryException
. While my index on disk is 1.24GB, I suspect that the object size of the RAMDirectory
object ends up exceeding the .NET 2GB object size limit and the exception is therefore thrown. Another reason might be that the virtual address space is simply too fragmented to find a hole big enough for my object.
I would love to continue using RAMDirectory
. How can I do that while avoiding the OutOfMemoryException
?
Please also note that when I write my index I call IndexWriter.Optimize
so the entire index is in one big file.