Leveraging garbage collection to dynamically infer heap invariants
First Claim
1. A method of inferring heap invariants for program objects maintained by a program in heap memory, comprising:
- causing the program to execute over a period in an execution environment having a heap memory managed using garbage collection;
creating meta data to track invariants of the program objects created by the program in the heap memory;
upon a vitality check of the program objects in a garbage collection pass, checking the invariants of the program objects and updating the meta data based on results of the checking; and
producing data reporting the invariants satisfied by the program objects over the period of execution of the program.
2 Assignments
0 Petitions
Accused Products
Abstract
A program analysis tool leverages the garbage collection process to dynamically infer invariants of objects or data structures created by a program on the heap during execution. During execution of the program in a garbage-collected execution environment, the program analysis tool tracks object allocations made by the program, and records some meta data relating to invariants tracked for the type of the object, which are initially assumed satisfied by the object. Whenever a garbage collection pass visits the object, the tool checks whether the object still satisfies the invariants, and updates the meta data accordingly. The tool finally reports the invariants reflected by the meta data upon the object'"'"'s death or at termination of the program. The invariants can then be used to annotate the program source code and/or detect bugs that violate the invariants.
-
Citations
20 Claims
-
1. A method of inferring heap invariants for program objects maintained by a program in heap memory, comprising:
-
causing the program to execute over a period in an execution environment having a heap memory managed using garbage collection;
creating meta data to track invariants of the program objects created by the program in the heap memory;
upon a vitality check of the program objects in a garbage collection pass, checking the invariants of the program objects and updating the meta data based on results of the checking; and
producing data reporting the invariants satisfied by the program objects over the period of execution of the program. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
-
-
12. A computer-readable computer program-carrying storage medium having software for a program analysis tool carried thereon, which is executable on a computer system to perform analysis of a program under test to infer heap invariants of program objects maintained by said program under test in heap memory, the program analysis tool comprising:
-
a heap executive providing a heap allocator application programming interface service to allocate memory space in heap memory upon request from said program under test, and a garbage collector operating to periodically perform a garbage collection pass over program objects created by said program under test in heap memory in which the garbage collector tests the program objects'"'"' liveness; and
an invariant inference service operating across an execution of said program under test to maintain meta data tracking a set of invariants per program object, the invariant inference service operating when the garbage collector tests liveness of a program object to also check that the program object continues to satisfy the invariants tracked for the respective object, the invariant inference service producing a report indicating the invariants satisfied by the program objects across the execution of said program under test. - View Dependent Claims (13, 14, 15, 16, 17)
-
-
18. A dynamic program analysis system for inferring heap invariants of program objects maintained by a program in heap memory, the system comprising:
-
means for causing the program to execute over a period in an execution environment having a heap memory managed using garbage collection;
means for creating meta data to track invariants of the program objects created by the program in the heap memory;
means responsive to a vitality check of the program objects in a garbage collection pass for checking the invariants of the program objects and updating the meta data based on results of the checking; and
means for producing data reporting the invariants satisfied by the program objects over the period of execution of the program. - View Dependent Claims (19, 20)
-
Specification