Small correction: It's not fully true that the JVM "never" gives back memory to the operating system: The G1 collector can give back memory to the OS since the beginning, but it does this only on full GCs which it tries to prevent.
But: The default collector as shipped with Java 8 (ParallelGC) never gives back any memory to OS, same applies for ConcMarkSweepGC. And I assume you are using this one. Uwe ----- Uwe Schindler Achterdiek 19, D-28357 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de > -----Original Message----- > From: Uwe Schindler <u...@thetaphi.de> > Sent: Thursday, April 4, 2019 11:49 AM > To: java-user@lucene.apache.org > Subject: RE: Why does Lucene 7.4.0 commit() Increase Memory Usage x2 > > Hi, > > Thanks Adrien. With current JVM versions (Java 8 or Java 11), the garbage > collector never gives back memory to the operating system, once it has > allocated that. Due to now heavy usage of containers and similar techniques, > there are efforts on the JVM front to change that: At least the G1 garbage > collector (also IBM J9's collector and also the brand new Shenandoah, but > not the good old CMS) gets a new feature to give back memory to the > operating system to a certain amount if it is idle, starting with Java 12: > https://openjdk.java.net/jeps/346 > > But that's still a tricky issue, because if you limit the size of allocated > memory, > the garbage collection needs to happen more often, which if you have > enough reserved space, the GC has a more relaxed job. > > Uwe > > ----- > Uwe Schindler > Achterdiek 19, D-28357 Bremen > http://www.thetaphi.de > eMail: u...@thetaphi.de > > > -----Original Message----- > > From: Adrien Grand <jpou...@gmail.com> > > Sent: Thursday, April 4, 2019 10:00 AM > > To: Lucene Users Mailing List <java-user@lucene.apache.org> > > Subject: Re: Why does Lucene 7.4.0 commit() Increase Memory Usage x2 > > > > I think what you are experiencing is just due to how the JVM works: it > > happily reserves memory to the operating system if it thinks it might > > need it, and then it's reluctant to give it back because it assumes > > that if it has needed so much memory in the past, it might need it > > again in the future. If you don't want to JVM to use so much memory, > > just pass a lower value of the maximum heap size. > > > > On Wed, Apr 3, 2019 at 4:11 PM thturk <tahatur...@hotmail.com> wrote: > > > > > > I have tried Java VisualVM too watch GC status per each commit and > relase > > > variables for Reader Writer Searcher. But as result GC working like in > > > photo at below > > > > > > <http://lucene.472066.n3.nabble.com/file/t494233/Ekran_Al%C4%B1nt%C4 > > %B1s%C4%B1.png> > > > After 16.40 I called GC manully but Heap size didnt decrease is it cos > > > its > > > take while to merge serment for lucene ? cos after a hour Memory > Ussage > > > Decreased around 3G it was 3.5G after add new 15k document. > > > > > > > > > > > > -- > > > 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 > > > > > > > > > -- > > Adrien > > > > --------------------------------------------------------------------- > > 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 --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org