Patent ID: 8245209

Claim:
A method comprising: maintaining a balanced binary tree data structure having a plurality of nodes, each node representing one of: a heap record corresponding to heap memory that has been allocated, the heap record including a linked list of at least one pointer, the linked list including a reference to the heap memory that has been allocated; and, a stack record corresponding to a stack for a thread, where a stack frame is allocated within the stack each time the thread enters a function, the stack record including an array of at least one frame record, each frame record of the array including a linked list of at least one pointer, the linked list including a reference to a stack frame of the frame record; maintaining a status table data structure for the balanced binary tree data structure, the status table data structure including an entry for each pointer within a linked list of each heap record of the binary tree data structure and each pointer within a linked list of each frame record of each stack record of the binary tree data structure, the status table data structure (i) indicating whether each pointer is valid or invalid, (ii) indicating a node of the heap record or the stack record that includes each pointer within a linked list thereof, (iii) where the node represents a stack record, providing an index to the frame record within the array of at least one frame record that includes a pointer of that stack record within a linked list thereof, and (iv) where the node represents a heap record, providing an index having a zero value; and, using the balanced binary tree data structure and the status table data structure to perform at least one of (i) detecting a dangling pointer and (ii) detecting a memory leak location.