A method and software for analyzing a heap is described, in which a
snapshot is made of a heap, which can be later analyzed by an analysis
tool when a program that had run out of memory is no longer running. In
one embodiment, an object allocated by the program is accessed and copied
into a file, and an address of the object allocated by the process is
recorded in association with an offset in the file of the copy of the
object. The copy of the object copied into the file has preferably the
same size as the object allocated by the process. A heap analysis tool
may then be run on the objects copied into the file.