This really seems like an XY problem. What are you trying to accomplish that makes you want to use RAMDirectory at all? Why I'm asking:
1> RAMDirectory is quite special-purpose, very rarely is it something you should use 2> Java doesn't collect garbage when you close an object that references it, it'll be collected on some later GC cycle. You can attach something like jconsole and hit the "force GC" button to see if the memory is released. 3> bq. "when i want to initialize app via tomcat its loaded all memory then write to disk which i dont want to have" Again, what is the purpose here? What are you trying to accomplish _for the user_? I frankly have no idea what "loaded all memory then write to disk" means. Writing to disk doesn't happen unless you're updating documents. Best, Erick On Thu, Oct 25, 2018 at 6:33 AM thturk <tahatur...@hotmail.com> wrote: > > I want to release ram when i want , > i have tired to close created reader, ram directory, and searcher given in > below; > > ramDir = new RAMDirectory(FSDirectory.open(indexDir), IOContext.READ); > reader = DirectoryReader.open(ramDir); > searcher = new IndexSearcher(reader); > > searcher = null; > reader.close(); > reader = null; > ramDir.close(); > ramDir = null; > > but it didnt released Ram ,and when i wantto initialize app via tomcat its > loaded all memory then write to disk which i dont want to have > > Is there anyone know what is the best way for this . > Thanks for your help. > > > > -- > Sent from: http://lucene.472066.n3.nabble.com/Lucene-Java-Users-f532864.html > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org