A method and system for determining the memory utilization of a heap are
provided. With the method and system, object allocations and optionally,
possible memory freeing events are used to initiate a mark-and-count
operation. The mark-and-count operation marks the live objects and
maintains a running count of their memory bytes allocated to the live
objects, referred to as a live count. The execution of the mark-and-count
operation may be dependent upon various criteria including thresholds,
functions of the live count, peak live counts, number of memory bytes
allocated since a previous mark-and-count operation was performed, and
the like. In addition to the live count, a peak live count may be
obtained and updated as new peak live counts are identified. When the
peak live count is updated, additional information may be obtained via a
heap dump, arcflow tree, or the like.