Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Memory Analyzer (MAT) » Need help to analyse result given by MAT
Need help to analyse result given by MAT [message #507875] Thu, 14 January 2010 18:24 Go to next message
Aurelien Pupier is currently offline Aurelien Pupier
Messages: 558
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

Hi,

I would appreciate if you can help me to analyse some results and tell me if my first analyse is right.

I took a dump after I only do the same operation several times (start/stop Jetty server and deploying a two WebApplication and one of them launch a Platform for Birt)


Now I compare the result :
it appears that there is a leak of WebAppClassLoader :
http://img31.imageshack.us/img31/6537/leakreport.jpg

So in histogram I filtered on WebAppClassLoader, and there is twelve instances of WebAppClassLoader although I though that there was only two
WebAppClassLoader as I launch only two WebApplication at a time :
http://img695.imageshack.us/img695/2441/webappclassloader.jpg

So I use MAT to see the shortest path to GC root excludeing weak/soft/phantom references and the result is here :
http://img63.imageshack.us/img63/5877/shortestpath.jpg

We can notice that the our class BirtEngine seems to be the one that retain the ClassLoader.
So a search for BirtEngine :
http://img63.imageshack.us/img63/1424/birtengine.jpg
I have seevral BirtEngine but no one is instanciated.
So ok BirtEngine is a Singleton but I set all his attribute to null before releasing.

And in the previous screenshot we can see that the WebAppClassLoader is referenced because it is the <classloader> of BirtEngine.

So how can I release this WebAppClassLoader? How to release the class (and not object) of BirtEngine?

Thanks for any hints :
- where to search answer?
- Is my analyse correct?
- Am I misunderstranding something?
- is there another option in MAT that can help me?
- Or do I need another tool to resolve my issue?


Regards


Aurélien Pupier - BonitaSoft S.A.
My blog
My company Eclipse-related blog
Re: Need help to analyse result given by MAT [message #507924 is a reply to message #507875] Fri, 15 January 2010 03:54 Go to previous messageGo to next message
Krum Tsvetkov is currently offline Krum Tsvetkov
Messages: 149
Registered: July 2009
Senior Member
Hi,

This is a very interesting question.

I think the analysis you did is very good, but the problem seems to be tricky.
You found already that the classloaders are kept after the restart of the app, and you found one path to them - the one from the BirtEngine class. This class is marked as a GC root with the reason Native Heap, which should mean there is references somewhere from the native heap. And I can't tell why.

The Merged Shrotest paths gives you only one path per object. What you could try is to run Paths From GC roots on one of the objects and see if it will return you more paths. You can also look at the inbound references to a classloader (context menu, list objects -> with incoming references).

Howefer all these are just to search for another path, and will not answer the question why the BirtEngine classes are marked as "native heap" GC roots.

BTW, I remember I have seen some of my instances marked as "Native heap" and not removed as I was debugging, had a breakpoint on this place, and was using the "All Instances" context menu in the debugger. I couldn't explain it then. Were you by chance debugging when this happened?

Does this help in any way?
Re: Need help to analyse result given by MAT [message #507943 is a reply to message #507875] Fri, 15 January 2010 04:25 Go to previous messageGo to next message
Aurelien Pupier is currently offline Aurelien Pupier
Messages: 558
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

Thanks for your answer, it helps me a lot : it gives valuable information to explore different ways.
I will try that from now on

I am in remote debug mode and I have a jconcole connected to take dump. I will give a give a try now without that.

It seems that there is another path from GC roots, I will take a look deeper too.



Aurélien Pupier - BonitaSoft S.A.
My blog
My company Eclipse-related blog
Re: Need help to analyse result given by MAT [message #507945 is a reply to message #507875] Fri, 15 January 2010 04:32 Go to previous messageGo to next message
Markus Kohler is currently offline Markus Kohler
Messages: 4
Registered: July 2009
Junior Member
From what I see in your screen shots it seems that the classloader is referenced by several "instances" of the class BirtEngine. E.g. you can load the same class more than once.
MAT reports that those BirtEngine classes are GC roots because they are referenced by native code. Unfortunately there's no information in the heap dump that could tell you which native code.
I would try to track down why and from where those BirtEngine classes are loaded.

Hope that helps,
Markus

Re: Need help to analyse result given by MAT [message #507963 is a reply to message #507875] Fri, 15 January 2010 05:43 Go to previous messageGo to next message
Aurelien Pupier is currently offline Aurelien Pupier
Messages: 558
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

OMG it seems that there are no more WebAppClassLoader retained when not be in remote debug mode and without the jconsole connected...
I connected via the JConsole only at the end of repeating several times(~20) the same operation to take the dump and it seems that there were no more leaks...

Howevert I noticed that there still be 2 BirtEngine not instanciated but perhaps the GC is not passed onto it yet.

Another thing that seems to be strange is that the memory usage displayed by Windows Task Manager is increasing a little amount at each time.

But without debug mode it is hard to see exactly what happened. I hope that it is good.

Thanks for your great help



Aurélien Pupier - BonitaSoft S.A.
My blog
My company Eclipse-related blog
Re: Need help to analyse result given by MAT [message #507966 is a reply to message #507963] Fri, 15 January 2010 06:22 Go to previous message
Krum Tsvetkov is currently offline Krum Tsvetkov
Messages: 149
Registered: July 2009
Senior Member
This with the debugging is really strange. I found it while playing with the problem described here https://bugs.eclipse.org/bugs/show_bug.cgi?id=287852

I added one comment today, may be this helps the people there.

The 2 classes you see are may be ok. Look who loaded them, who keeps them, etc...

About the task manager I wouldn't worry. It does show how much memory the process reserved and uses, but doesn't reflect the state of the java heap. I mean, the memory in task manager may have grown as the java heap was resized. But this will probably stay so for a while even if GC can clean everything in the java heap.
Previous Topic:Same Class on different line in histogram
Next Topic:How to Increase heap size for MAT in IBM ISA?
Goto Forum:
  


Current Time: Sat Aug 23 15:28:52 EDT 2014

Powered by FUDForum. Page generated in 0.01853 seconds