Method and apparatus for detecting memory leaks using expiration events and dependent pointers to indicate when a memory allocation should be de-allocated
First Claim
1. A method for detecting memory leaks in a program executing on a computer system using memory management functions, said memory management functions operative to query and maintain a memory allocation table for storing information regarding currently allocated blocks of computer memory in said computer system including corresponding requesting file information and de-allocation information, said method comprising the steps of:
- allocating a block of computer memory for a function in said program requesting said block of computer memory, said function being a basic programming unit of said program;
specifying said de-allocation information for said block of computer memory being allocated, said de-allocation information indicative of when said currently allocated blocks of computer memory should be de-allocated, wherein the step of specifying said de-allocation information for said block of computer memory being allocated includes specifying an expiration event for said block of computer memory being allocated, said expiration event being an occurrence indicative of when said block of computer memory should be de-allocated, and assigning a unique numerical values as said expiration event in said memory allocation table, said unique numerical value indicative of a type of said expiration event, said type of expiration event includes an expiration event where an expiration should never occur;
storing said requesting file information and de-allocation information corresponding to said function requesting said block of computer memory in said memory allocation table using said memory management functions,querying said memory allocation table using said memory management functions for said currently allocated blocks of computer memory having de-allocation events thereby indicating corresponding said currently allocated blocks of computer memory should have been de-allocated.
2 Assignments
0 Petitions
Accused Products
Abstract
The invention utilizes expiration events and dependent pointers to indicate when the corresponding memory allocation should be de-allocated. Expiration events are occurrences that indicate corresponding memory allocations should be de-allocated prior to the occurrence of the event. Dependent pointers are pointers to currently allocated blocks of computer memory. These dependent pointers indicate that the corresponding computer memory allocation should be de-allocated prior to the de-allocation of the computer memory allocation referred to by the dependent pointer. Using memory management functions, the expiration events and dependent pointers are stored in a memory allocation table along with filenames and line numbers indicating where the request was made. At given points in the program, the memory allocation table is checked for memory leaks. Specifically, the memory allocation table is checked for currently allocated blocks of computer memory which have an expired expiration event that has occurred or a dependent pointer which points to a de-allocated memory allocation.
80 Citations
17 Claims
-
1. A method for detecting memory leaks in a program executing on a computer system using memory management functions, said memory management functions operative to query and maintain a memory allocation table for storing information regarding currently allocated blocks of computer memory in said computer system including corresponding requesting file information and de-allocation information, said method comprising the steps of:
-
allocating a block of computer memory for a function in said program requesting said block of computer memory, said function being a basic programming unit of said program; specifying said de-allocation information for said block of computer memory being allocated, said de-allocation information indicative of when said currently allocated blocks of computer memory should be de-allocated, wherein the step of specifying said de-allocation information for said block of computer memory being allocated includes specifying an expiration event for said block of computer memory being allocated, said expiration event being an occurrence indicative of when said block of computer memory should be de-allocated, and assigning a unique numerical values as said expiration event in said memory allocation table, said unique numerical value indicative of a type of said expiration event, said type of expiration event includes an expiration event where an expiration should never occur; storing said requesting file information and de-allocation information corresponding to said function requesting said block of computer memory in said memory allocation table using said memory management functions, querying said memory allocation table using said memory management functions for said currently allocated blocks of computer memory having de-allocation events thereby indicating corresponding said currently allocated blocks of computer memory should have been de-allocated. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9)
-
-
10. An apparatus for detecting memory leaks in a program executing on a computer system having blocks of computer memory, wherein said program comprise at least one function, said apparatus comprising of:
-
a virtual memory manager for allocating blocks of computer memory for said functions requesting said blocks of computer memory; a memory allocation table operative to store requesting file information and de-allocation information corresponding to currently allocated blocks of computer memory, said de-allocation information indicative of when said currently allocated blocks of computer memory should be de-allocated; means for specifying de-allocation information for said blocks of computer memory being allocated in said memory allocation table, wherein said means for specifying de-allocation information includes means for specifying expiration events in said memory allocation table for said blocks of computer memory being allocated, said expiration events being occurrences that indicate when said blocks of computer memory should have been de-allocated, and means for assigning a unique numerical values as said expiration event in said memory allocation table, said unique numerical value indicative of a type of said expiration event, said type of expiration event includes an expiration event where an expiration should never occur; and debugging memory management means for querying said memory allocation table for said currently allocated blocks of computer memory having de-allocation events indicating corresponding said currently allocated blocks of computer memory should have been de-allocated. - View Dependent Claims (11, 12, 13, 14, 15, 16, 17)
-
Specification