title: java heap analysis with oql: Count unique strings
body: <p>Im doing a memory analysis of an existing java software. Is there a sql 'group by' equivalent in oql to see the count of objects with same values but different instances.</p>
  
  <p>select count(*) 
  from java.lang.String s
  group by s.toString()</p>
  
  <p>I'd like to achieve a list of duplicated strings along with the number of duplicates. The purpose of this is to see the cases with large numbers so that they could be optimized using String.intern().</p>
  
  <p>Example:</p>
  
  <pre><code>"foo"    100
  "bar"    99
  "lazy fox"    50
  </code></pre>
  
  <p>etc...</p>