Analyzing Java Collection Usage

A collection is an object that are used to store, retrieve and manipulate the data. Memory Analyzer offers the following queries to analyze java collections:

Array Fill Ratio Query Prints a frequency distribution of fill ratios of non-primitive arrays. The fill ratio is the proportion of non-null elements in the array. The arrays are then accumulated into as many segments as parameterized. Primitive arrays cannot have null values so this query works only on object arrays.
Arrays Grouped by Size Query Distribution histogram of given arrays grouped by the size.
Collection Fill Ratio Query

Prints a frequency distribution of fill ratios of given collections. The following collections can be used for the query:

  • java.util.ArrayList
  • java.util.HashMap
  • java.util.Hashtable
  • java.util.Properties
  • java.util.Vector
  • java.util.WeakHashMap
  • java.util.concurrent.ConcurrentHashMap$Segment
  • java.beans.beancontext.BeanContextSupport
  • java.lang.ThreadLocal$ThreadLocalMap
  • java.util.ArrayDeque
  • java.util.HashSet
  • java.util.IdentityHashMap
  • java.util.PriorityQueue
  • java.util.Vector
  • java.util.WeakHashMap
  • java.util.concurrent.ConcurrentHashMap
  • java.util.concurrent.CopyOnWriteArrayList
  • java.util.concurrent.CopyOnWriteArraySet
  • java.util.concurrent.DelayQueue
  • java.util.jar.Attributes
  • javax.script.SimpleBindings

One additional custom collection (e.g. non-JDK) collection can be specified by the 'collection', 'size_attribute' and 'array_attribute' argument.

Collections Grouped By Size Query

Distribution histogram of given collections by their size. The following collections can be used for the query. Known collections:

  • java.util.ArrayList
  • java.util.TreeMap
  • java.util.HashMap
  • java.util.Hashtable
  • java.util.Properties
  • java.util.Vector
  • java.util.WeakHashMap
  • java.util.concurrent.ConcurrentHashMap
  • java.util.concurrent.ConcurrentHashMap$Segment
  • java.util.ArrayDeque
  • java.util.HashSet
  • java.util.IdentityHashMap
  • java.util.LinkedList
  • java.util.PriorityQueue
  • java.util.TreeSet
  • java.util.concurrent.ConcurrentSkipListMap
  • java.util.concurrent.ConcurrentSkipListSet
  • java.util.concurrent.CopyOnWriteArrayList
  • java.util.concurrent.CopyOnWriteArraySet
  • java.util.concurrent.DelayQueue
  • java.util.concurrent.LinkedBlockingDeque
  • java.util.concurrent.LinkedBlockingQueue
  • java.util.concurrent.SynchronousQueue
  • java.util.jar.Attributes
  • java.beans.beancontext.BeanContextSupport
  • java.lang.ThreadLocal$ThreadLocalMap
  • javax.script.SimpleBindings
  • javax.swing.UIDefaults

One additional custom collection (e.g. non-JDK) collection can be specified by the 'collection', 'size_attribute' and 'array_attribute' argument.

Extract List Values Query

Lists elements of a single LinkedList, ArrayList, Vector, CopyOnWriteArrayList, PriorityQueue, ArrayDeque object.

Hash Entries Query

Extracts the key-value pairs from hash maps and hashtables.

Extract Hash Set Value Query

Lists elements of a single HashSet.

Map Collision Ratio Query

Prints a frequency distribution of the collision ratios of map-like collections. The following map-like collections can be used for the query.

  • java.util.HashMap
  • java.util.Properties
  • java.util.Hashtable
  • java.util.WeakHashMap
  • java.util.concurrent.ConcurrentHashMap$Segment
  • java.util.HashMap
  • java.util.HashSet
  • java.util.Hashtable
  • java.util.IdentityHashMap
  • java.util.concurrent.ConcurrentHashMap
  • java.util.concurrent.ConcurrentSkipListMap
  • java.util.concurrent.ConcurrentSkipListSet
  • java.util.jar.Attributes
  • java.beans.beancontext.BeanContextSupport
  • java.lang.ThreadLocal$ThreadLocalMap
  • javax.script.SimpleBindings
  • javax.swing.UIDefaults

One additional custom map-like (e.g. non-JDK) collection can be specified by the 'collection', 'size_attribute' and 'array_attribute' argument.

Primitive Arrays with a Constant Value Lists all primitive arrays (from a selection) which are filled with one and the same value

All these queries are accessible from the toolbar drop-down menu: Open Query Browser > Java Collections