I need help finding my memory leak using MAT

2019-02-13 08:38发布

I'm using the MAT to compare two heap dumps. I've been taking a heap dump each day and it's growing by about 200 megs each day. I think the leak is associated with java.util.zip because of what the table shows and also because we added a new process recently that zips and unzips a lot of files. (see image)

Heap dump histogram compare

At this point I open the dominator and filtered for .Inflater. That produced a large list of java.util.zip.Inflater. Now I want to see what's holding these open so I picked one and ran the Path to GC root excluding weak and soft references (see image).

GC Root

It looks like this has to do with the jar inflation and nothing to do with my process. At this point I'm stuck and need some suggestions.

EDIT 1

Sean asked about the ThreadLocals. If you look at the dominator_tree with no filter you see that java.lang.ApplicationShutdownHooks is 58% of the heap. If I expand some of those entries you can see that they seem to be in the ThreadLocalMap. How would I find what put them there?

enter image description here

EDIT 2

Sean's comment put me on the correct track. I'm using Glassfish v 2.0 and it has a memory leak. It continually creates new LogManagers and adds them to the ApplicationShutdownHooks collection.

I worked around the issue by cracking open the ApplicationShutdownHooks and manually removing the objects from the collection.

1条回答
我欲成王,谁敢阻挡
2楼-- · 2019-02-13 09:24

Sean's comment put me on the correct track. I'm using Glassfish v 2.0 and it has a memory leak. It continually creates new LogManagers and adds them to the ApplicationShutdownHooks collection.

I worked around the issue by cracking open the ApplicationShutdownHooks and manually removing the objects from the collection.

查看更多
登录 后发表回答