Use tools to visualize GC activity
Some such tools:
VisualVM (with GC extension)
Some Important Parameters
GC - The garbage collector in use.
Size of the Java heap.
Size of the young and old generation spaces.
Duration of minor garbage collections.
Frequency of minor garbage collections.
Duration of full garbage collections.
Frequency of full garbage collections.
What initiates full GC; old gen or perm space.
Attributes of Java Performance
Pause Time: Minimal pause time due to
Throughput: Overall performance of user
process ignoring pauses due to GC
Footprint: Amount of memory required for
GC to run efficiently
GC Friendly Coding
GCs love small, immutable, short-lived objects
Object pooling is usually bad
Large objects are expensive to allocate,
expensive to initialize and may fragment CMS
Nulling references is usually bad
Avoid calling System.gc()
Avoid memory Leaks
Some sources: Objects in the wrong scope
Instances of inner classes