Assuming you're not really using code like above and it's a test case.... What's your evidence that memory consumption goes up? Are you sure you're not just seeing uncollected garbage?
When I attached Java Mission Control to this program it looked pretty scary at first, but the heap allocated after old generation garbage collections leveled out to a steady state. On Sat, Jan 30, 2016 at 9:29 AM, Walter Underwood <wun...@wunderwood.org> wrote: > Create one HttpSolrClient object for each Solr server you are talking to. > Reuse it for all requests to that Solr server. > > It will manage a pool of connections and keep them alive for faster > communication. > > I took a look at the JavaDoc and the wiki doc, neither one explains this > well. I don’t think they even point out what is thread safe. > > wunder > Walter Underwood > wun...@wunderwood.org > http://observer.wunderwood.org/ (my blog) > > >> On Jan 30, 2016, at 7:42 AM, Susheel Kumar <susheel2...@gmail.com> wrote: >> >> Hi Steve, >> >> Can you please elaborate what error you are getting and i didn't understand >> your code above, that why initiating Solr client object is in loop. In >> general creating client instance should be outside the loop and a one time >> activity during the complete execution of program. >> >> Thanks, >> Susheel >> >> On Sat, Jan 30, 2016 at 8:15 AM, Steven White <swhite4...@gmail.com> wrote: >> >>> Hi folks, >>> >>> I'm getting memory leak in my code. I narrowed the code to the following >>> minimal to cause the leak. >>> >>> while (true) { >>> HttpSolrClient client = new HttpSolrClient(" >>> http://192.168.202.129:8983/solr/core1"); >>> client.close(); >>> } >>> >>> Is this a defect or an issue in the way I'm using HttpSolrClient? >>> >>> I'm on Solr 5.2.1 >>> >>> Thanks. >>> >>> Steve >>> >