Search code examples
javavisualvmjvisualvmoql

OQL syntax for counting Strings matching criteria


Please help me. I analyse my heap dump in VisualVM.

How can I get amount of all Strings with value == "0"? I have the following query:

select count(s) from java.lang.String s where s.toString().equals("0");

But it doesnt work. I want to receive amount of all Strings with "0" value and if it's possible their size in memory.


Solution

  • That's solved my problem

    select count(heap.objects('java.lang.String'), "it.toString().equals('0')")