Patent ID: 8032568

Claim:
An automated method for performing a memory leak analysis inside a virtual machine comprising: accessing a heap in a main memory, a node in the heap representing an object; building a list of root objects from thread stacks and class statics, a thread stack locating in a stack in the main memory, a thread having a thread stack, class statics storing static classes that cannot be discarded; executing a depth first search (DFS) algorithm on the heap from a root object in the list of root objects, a thread stack, or class statics; initializing a variable reachability and a variable largest child reachability to zero and calculating a value of the variable reachability of a current object being visited by subtracting a value of a variable count on entry from a value of a current variable count, the current value of the variable count being determined by a size of all objects fully visited before, the value of the variable count on entry being determined by a current value in the variable count upon visiting the current object; determining a value of the variable largest child reachability of the current object being visited, the value of the variable largest child reachability of the current object being visited being determined by a largest reachability value among children of the current object being visited; comparing the value of the variable reachability of the current object being visited to a first threshold; comparing the value of the variable largest child reachability of the current object being visited to a second threshold; and when the value of the variable reachability of the current object being visited is larger than the first threshold and when the value of the variable largest child reachability of the current object being visited is less than the second threshold, determining the current object being visited as a source of a memory leak, wherein the accessing step, the building step, the executing step, the initializing step, the calculating step, the comparing steps and the determining step are performed inside the virtual machine.