Browse Prior Art Database

Enhanced Virtual Machine for Unnecessary Memory Use Detection Disclosure Number: IPCOM000029562D
Original Publication Date: 2004-Jul-07
Included in the Prior Art Database: 2004-Jul-07
Document File: 2 page(s) / 50K

Publishing Venue



We present a technique for isolating the objects responsible for memory growth in a long-running process in a garbage collected environment. The technique is based on careful gathering of usage information at runtime to eliminate the need to attach a debugger. We give an embodiment of the idea through enhancement of the operation of certain virtual machine instructions in the Java Virtual Machine.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 51% of the total text.

Page 1 of 2

Enhanced Virtual Machine for Unnecessary Memory Use Detection

Memory leak detection and identification in long-running (eg server) processes is a long-standing problem. In non-garbage-collected environments, such detection and identification occurs almost exclusively offline, under the control of a programmer armed with a debugger. Garbage-collected environments, particularly those that organize their store into generations, offer the opportunity to gather informative data at low cost in an operational setting. In particular, memory growth that is the direct result of unnecessary object retention can be quite cheaply detected.

Memory management systems based exclusively on garbage collection divide an object's lifecycle into the period in which an object is born, the period in which an object is reachable from a collection of roots, and the period in which an object is no longer reachable from that collection of roots. This division is based on a weak approximation to the notion of "live." An object is live when the object will be used again in the future of the computation. An object that is reachable from the collection of roots may be live, and an object that is not reachable from that collection is certainly not live , but in between are the objects that remain reachable but will not be used again. These objects contribute to the memory footprint of the program, but may not contribute to the values computed by the program. Objects that in fact do not contribute are considered "unnecessarily retained."

The technique we describe is based on the observation that the longer an object is not constructively used, the greater the probability that it will not ever be constructively used. The basic mechanism of the technique works by marking objects as their public interfaces are invoked or public fields used, then using these markings to move objects from one usage generation to another during copying garbage collection. As a simple example, consider a three usage generation system, wherein each generation is stamped with a time and each object is marked if it is used after that time. A copying mechanism that finds a reachable object that has not been used since the timestamp copies it into the next older generation; similarly, an object that has been used since the last timestamp moves back into the youngest usage generation. This is easily implemented in a Java Virtual Machine implementation with modifications to th...