On 1/30/2016 6:15 AM, Steven White wrote: > 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?
As mentioned by others, you are indeed using HttpSolrClient incorrectly. Even so, the fact that this code causes OOM does indicate that *something* is leaking in your environment. I could not reproduce the leak. I tried the above code loop in some test code (as a testcase in the branch_5x code) and could not get it to OOM orshow any evidence of a leak. I let it run for ten minutes on a 512MB heap, which produced this jconsole memory graph: https://www.dropbox.com/s/em392mx1gr6af67/client-loop-memory-graph.png?dl=0 That memory graph does not look like a program with a memory leak. Here's the test code that I was running -- specifically, the testFullClient() method: https://www.dropbox.com/s/dooy5bayv4hu6jk/TestHttpSolrClientMemoryLeak.java?dl=0 What versions of the dependent jars do you have in your project? There might be something leaking in a dependency rather than within SolrJ. I also set up a test program using SolrJ 5.2.1, with updated dependencies beyond the versions included with SolrJ, and could not get that to show a leak either. Thanks, Shawn