Heap profiling serves a number of purposes: pinpointing the part of program that performs excessive heap allocation, revealing the performance characteristics of the underlying garbage collection algorithm, and detecting the causes of unnecessary object retention.