hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amon Amon <argenst...@hotmail.com>
Subject Re: HttpClientBuilder Memory Leak
Date Wed, 03 Feb 2016 20:09:19 GMT


What happened when there was no more JVM memory? Was the  garbage collector able to free the
used memeory?

What happens when you run the garbage collector manually? 


Cheers,
Amon

________________________________________
From: David Skalka <david.skalka@gmail.com>
Sent: Wednesday, February 3, 2016 8:06 PM
To: HttpClient User Discussion
Subject: Re: HttpClientBuilder Memory Leak

Sorry for delay.

java varsion is 1.8.0. 66-b17.  The graph was made by Jprofiler.

I tested same code with Yourkit a Jconsole wihout any leak. I dont
understand it.

Can someone profile this code using JProfiler? It looks at the serious
errors of JProfiler


2016-02-02 23:15 GMT+01:00 Gary Gregory <garydgregory@gmail.com>:

> Curious: What profiler and java version are you using?
>
> Gary
>
> On Tue, Feb 2, 2016 at 1:39 PM, David Skalka <david.skalka@gmail.com>
> wrote:
>
> > I updated httpclient to 4.5.1  and after 30minutes I see same result.
> > memory is growing up
> >
> > 2016-02-02 21:51 GMT+01:00 Dan Quaroni <q@invoke.com>:
> >
> > > I don't really know what program is producing this image, but what I
> see
> > in
> > > this picture is that there are a lot of Strings in memory, which seem
> to
> > be
> > > living in HashMap(s).  I don't know how this program he used analyzes
> > > memory usage... But either way, I can't reproduce it.
> > >
> > > On Tue, Feb 2, 2016 at 3:36 PM, Oleg Kalnichevski <olegk@apache.org>
> > > wrote:
> > >
> > > > On Tue, 2016-02-02 at 15:29 -0500, Dan Quaroni wrote:
> > > > > What version of HttpClient are you using?  I cut the sleep down to
> > 1ms
> > > > and
> > > > > have had it running for 25 minutes and am not observing any such
> > memory
> > > > > leak.
> > > > >
> > > >
> > > > If one takes even a cursory look at the memory profile one can
> clearly
> > > > see that out several dozen classes on the heap only one class belongs
> > to
> > > > HttpCient - CPool and there are only ~900 instances of that class
> > > > compared to millions of instances of other classes.
> > > >
> > > > Oleg
> > > >
> > > > > On Tue, Feb 2, 2016 at 3:21 PM, Oleg Kalnichevski <
> olegk@apache.org>
> > > > wrote:
> > > > >
> > > > > > On Tue, 2016-02-02 at 21:16 +0100, David Skalka wrote:
> > > > > > > what is it "own data" ?
> > > > > > >
> > > > > >
> > > > > > https://drive.google.com/open?id=0B8cERbS5JTTtZkVpWmhVWS11UkU
> > > > > >
> > > > > > Oleg
> > > > > >
> > > > > >
> > > > > > > 2016-02-02 21:11 GMT+01:00 Oleg Kalnichevski <olegk@apache.org
> >:
> > > > > > >
> > > > > > > > On Tue, 2016-02-02 at 20:58 +0100, David Skalka wrote:
> > > > > > > > > it is simple test application with one while.
here is whole
> > > > source
> > > > > > code:
> > > > > > > > >
> > > > > > > >
> > > > > > > > Have you looked at your own data?
> > > > > > > >
> > > > > > > > Oleg
> > > > > > > >
> > > > > > > > >
> > > > > > > > > import java.io.IOException;
> > > > > > > > >
> > > > > > > > > import org.apache.http.impl.client.CloseableHttpClient;
> > > > > > > > > import org.apache.http.impl.client.HttpClientBuilder;
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > public class Program {
> > > > > > > > >
> > > > > > > > >     public static void main(String[] args) throws
> > IOException,
> > > > > > > > > InterruptedException {
> > > > > > > > >
> > > > > > > > >         while(true){
> > > > > > > > >             CloseableHttpClient httpclient =
> > > > > > > > > HttpClientBuilder.create().build();
> > > > > > > > >             httpclient.close();
> > > > > > > > >             Thread.sleep(5);
> > > > > > > > >         }
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >     }
> > > > > > > > >
> > > > > > > > > }
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > 2016-02-02 20:51 GMT+01:00 Oleg Kalnichevski
<
> > olegk@apache.org
> > > >:
> > > > > > > > >
> > > > > > > > > > On Tue, 2016-02-02 at 20:42 +0100, David
Skalka wrote:
> > > > > > > > > > > sorry i dont understand you. What do
you mean by "what
> > does
> > > > this
> > > > > > all
> > > > > > > > tell
> > > > > > > > > > > you" ?
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Have you taken even a cursory look at your
own data?
> > > > > > > > > >
> > > > > > > > > > What makes you think there is a leak in
HttpClient?
> > > > > > > > > >
> > > > > > > > > > Oleg
> > > > > > > > > >
> > > > > > > > > > > 2016-02-02 20:21 GMT+01:00 Oleg Kalnichevski
<
> > > > olegk@apache.org>:
> > > > > > > > > > >
> > > > > > > > > > > > On Tue, 2016-02-02 at 19:30 +0100,
David Skalka
> wrote:
> > > > > > > > > > > > > Here is long running snapshot
with types
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > https://drive.google.com/open?id=0B8cERbS5JTTtZkVpWmhVWS11UkU
> > > > > > > > > > > >
> > > > > > > > > > > > And what does this all tell you?
> > > > > > > > > > > >
> > > > > > > > > > > > Oleg
> > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > 2016-02-02 17:22 GMT+01:00
Gary Gregory <
> > > > > > garydgregory@gmail.com
> > > > > > > > >:
> > > > > > > > > > > > >
> > > > > > > > > > > > > > Can you look and see
what kind of objects are
> > > retained?
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Gary
> > > > > > > > > > > > > > On Feb 2, 2016 2:33
AM, "David Skalka" <
> > > > > > david.skalka@gmail.com
> > > > > > > > >
> > > > > > > > > > wrote:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Why this code causes
a memory leak?
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > code:
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > *while(true){*
> > > > > > > > > > > > > > > * CloseableHttpClient
httpclient =
> > > > > > > > > > > > HttpClientBuilder.create().build();*
> > > > > > > > > > > > > > > * httpclient.close();*
> > > > > > > > > > > > > > > * Thread.sleep(5);*
> > > > > > > > > > > > > > > * }*
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Here is a graph
of memory allocation:
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > >
> > > > https://drive.google.com/file/d/0B8cERbS5JTTtMnUyVXJNZDRFbHM/view
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > ---------------------------------------------------------------------
> > > > > > > > > > > > To unsubscribe, e-mail:
> > > > > > httpclient-users-unsubscribe@hc.apache.org
> > > > > > > > > > > > For additional commands, e-mail:
> > > > > > > > httpclient-users-help@hc.apache.org
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > ---------------------------------------------------------------------
> > > > > > > > > > To unsubscribe, e-mail:
> > > > httpclient-users-unsubscribe@hc.apache.org
> > > > > > > > > > For additional commands, e-mail:
> > > > > > httpclient-users-help@hc.apache.org
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > ---------------------------------------------------------------------
> > > > > > > > To unsubscribe, e-mail:
> > > httpclient-users-unsubscribe@hc.apache.org
> > > > > > > > For additional commands, e-mail:
> > > > httpclient-users-help@hc.apache.org
> > > > > > > >
> > > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail:
> httpclient-users-unsubscribe@hc.apache.org
> > > > > > For additional commands, e-mail:
> > httpclient-users-help@hc.apache.org
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > > > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > >
> > > *Daniel Quaroni*
> > > Principal Software Architect
> > > P: 781.810.2743
> > > q@invoke.com
> > > www.invoke.com
> > > See a Demo here <http://www.invoke.com/platform/demo>
> > >
> >
>
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message