Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Memory Analyzer (MAT) » Finding top n largest strings
Finding top n largest strings [message #3900] Sat, 30 August 2008 09:54 Go to next message
Taras Tielkes is currently offline Taras Tielkes
Messages: 38
Registered: July 2009
Member
Hi,

How can I quickly query for the n largest Strings in a heap dump?
Apart from seeing how large the top n Strings are, I want to see their
contents as well (or at least the first x characters).

Thanks,
-tt
Re: Finding top n largest strings [message #3907 is a reply to message #3900] Sun, 31 August 2008 07:19 Go to previous messageGo to next message
Andreas Buchen is currently offline Andreas Buchen
Messages: 113
Registered: July 2009
Senior Member
> How can I quickly query for the n largest Strings in a heap dump?

Open the histogram (second button from the left in the toolbar),
right-click on "java.lang.String" and select "List Objects". Sort the list
by retained size (the memory kept alive by each String).

The list prints the first 1000 characters of the String. If you need more,
right-click "Copy -> Value" and the full value is copied to the clipboard.


If you want to extract the "count" property of the Strings, you could say
in OQL:
SELECT s.count, toString(s) FROM java.lang.String s


Andreas.
Re: Finding top n largest strings [message #3913 is a reply to message #3907] Sun, 31 August 2008 09:19 Go to previous messageGo to next message
Taras Tielkes is currently offline Taras Tielkes
Messages: 38
Registered: July 2009
Member
Hi Andreas,

I seems like I have a heap dump (with indexes) for which the histogram
calculation is extremely slow (still running after 15 minutes).
This is the first time I've had such a slow response after invoking the
histogram view. Perhaps some of the index files could be corrupted? Out
of curiosity, are the index files used in a read-only manner?

-tt

Andreas Buchen wrote:
>> How can I quickly query for the n largest Strings in a heap dump?
>
> Open the histogram (second button from the left in the toolbar),
> right-click on "java.lang.String" and select "List Objects". Sort the
> list by retained size (the memory kept alive by each String).
>
> The list prints the first 1000 characters of the String. If you need
> more, right-click "Copy -> Value" and the full value is copied to the
> clipboard.
>
>
> If you want to extract the "count" property of the Strings, you could
> say in OQL:
> SELECT s.count, toString(s) FROM java.lang.String s
>
>
> Andreas.
>
Re: Finding top n largest strings [message #3937 is a reply to message #3913] Mon, 01 September 2008 05:26 Go to previous message
Andreas Buchen is currently offline Andreas Buchen
Messages: 113
Registered: July 2009
Senior Member
Hi tt :-)

> I seems like I have a heap dump (with indexes) for which the histogram
> calculation is extremely slow (still running after 15 minutes).

That is strange. The default histogram is not really calculated, but
should always be available right away. The default histogram is the one
that is opened from the toolbar button.

What could be slow, though, is the calculation of the retained sizes for
each line of the histogram. Use the approximate times instead. It has an
error of about 2 to 4 percent, but it is ways faster. Any you'll find the
big chunks either way. But this functionality has to be triggered from the
toolbar separately.

Also, the histogram is used in other contexts too (e.g. displaying subsets
like all objects kept alive by all hash maps etc.). Depending on the
context, the calculation could take some time. But not for the default
histogram.

> Out of curiosity, are the index files used in a read-only manner?

Yes, the index files are created during the first parsing. After that,
they are used read-only. You could transfer them to another machine along
the heap dump and reopen the heap dump there.

Andreas.
Previous Topic:IllegalArgumentException In OQL Statement
Next Topic:class histogram presented as package treetable
Goto Forum:
  


Current Time: Thu Jul 24 16:01:52 EDT 2014

Powered by FUDForum. Page generated in 0.12998 seconds