string search using OQL

Geek picture Geek · Jul 17, 2012 · Viewed 13.5k times · Source

I am using VisualVM to analyze a core dump. I suspect some XML objects to be causing the leak but there are way too many String objects to go through one by one.

Can I use OQL to search String that begin with 'GH' ?

thanks for any help.

Answer

Yura picture Yura · Oct 8, 2014

under JDK 1.8.20 a more simple variant works:

select s from java.lang.String s where s.toString().startsWith("GH")