System and method for detecting memory management programming errors
AssigneeInternational Business Machines Corporation
InventorKenneth Carlin Nelson
Life of this patent
Estimating the term…
Abstract
A memory management functions system enables an efficient memory management programming errors. The system includes a server code that reports detailed trace data showing memory management calls; memory that was allocated but not freed; memory requested to be freed that was not allocated; corrupted memory immediately following the allocated space; and incorrect exit from a stored procedure that bypasses reporting and memory cleanup. In addition, the present system frees on exit, memory leaks or memories that were allocated but not explicitly freed earlier. These features allow a programmer to more readily easily detect and debug memory management errors within their program code.
Claims30
A method for detecting memory management programming errors, comprising:
- a calling function requesting a first memory function;
- replacing the first memory function with a replacement first memory function when the first memory function is detected;
- the replacement first memory function allocating a memory required by the first memory function;
- the replacement first memory function further adding a record to a list of allocations, wherein the entry comprises an address, memory size, a name of the calling function, and a line number of the calling function;
- wherein the first memory function is a malloc function;
- wherein the replacement first memory function is an ICMmalloc function;
- and
- wherein replacing the ICMcalloc function is implemented by adding a calloc record entry to the list of allocations, wherein the calloc record entry comprises an address, a memory size that is initialized to zero, a name of the calling function, and a line number of the calling function.
The method of 1, further comprising specifying a memory barrier size and configuration for memory debugging purpose.
A computer program product having executable instruction codes stored on a computer readable medium, for detecting memory management programming errors, comprising:
- a first set of instruction codes for requesting a first memory function;
- a second set of instruction codes for replacing the first memory function with a replacement first memory function when the first memory function is detected;
- wherein the replacement first memory function allocates a memory required by the first memory function;
- wherein the replacement first memory function further adds a record to a list of allocations;
- wherein the entry comprises an address, memory size, a name of the calling function, and a line number of the first set of instruction codes;
- wherein the first memory function is a malloc function;
- wherein the replacement first memory function is an ICMmalloc function;
- and
- wherein the second set of instruction codes replaces the first memory function with the replacement first memory function by replacing the ICMcalloc function is implemented by adding a calloc record entry to the list of allocations, wherein the calloc record entry comprises an address, a memory size that is initialized to zero, a name of the calling function, and a line number of the calling function.
A computer implemented system for detecting memory management programming errors, comprising:
- means for requesting a first memory function;
- means for replacing the first memory function with a replacement first memory function when the first memory function is detected;
- wherein the replacement first memory function allocates a memory required by the first memory function;
- wherein the replacement first memory function further adds a record to a list of allocations;
- wherein the entry comprises an address, memory size, a name of the calling function, and a line number of the first set of instruction codes;
- wherein the first memory function is a malloc function;
- wherein the replacement first memory function is an ICMmalloc function;
- and
- wherein the replacing means replaces the first memory function with the replacement first memory function by replacing the ICMcalloc function is implemented by adding a calloc record entry to the list of allocations, wherein the callloc record entry comprises an address, a memory size that is initialized to zero, a name of the calling function, and a line number of the calling function.
The system of 24, further comprising means for specifying a memory barrier size and configuration for memory debugging purpose.
Dependencies are inferred from the claim text.