Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mat-dev] Find Memory Leaks report hangs on "building histogram"

Thanks, build 1.5.0.201511171324 fixed problem!

2015-11-10 11:37 GMT+02:00 Антон Мацюк <denixx.baykin@xxxxxxxxx>:
Hi all!
I have an issue with MAT.
It is hanging on "building histogram" when I am choosing to find memory leaks after opening the hprof dump file.

I've researched the root of problem using debug, and found the way it hangs.
So, it goes to
private SuspectRecord buildSuspectRecordGroupOfObjects(ClassHistogramRecord record, IProgressListener listener) throws SnapshotException
This is a FindLeaksQuery.java, line 220.
First line says
int[] objectIds = getRandomIds(record.getObjectIds());
so it's calling getRandomIds, record's "label" is "org.apache.tomcat.util.net.NioChannel".
And it's objectIds field is an array with 10000 objects (0 to 9999).
So,
private int[] getRandomIds(int[] objectIds) (FindLeaksQuery.java, line 344) gets array of 10000 items.
if (objectIds.length < max_paths) is false, so it goes forward.
then
int length = objectIds.length - 1; // there length will be 9999.

And it hangs in "for" loop:

            int index = random.nextInt(length);
            while (visited.get(index))
                index = random.nextInt(length);

it will go to the end of free numbers, and will cycle in
            while (visited.get(index))
                index = random.nextInt(length);

It will endlessly try to generate id, but all of them are already used :(


Back to the top