Debugging methods for heap misuse

Data processing: software development – installation – and managem – Software program development tool – Testing or debugging

Reexamination Certificate

Rate now

  [ 0.00 ] – not rated yet Voters 0   Comments 0

Details

C717S125000, C717S126000, C717S127000

Reexamination Certificate

active

06658653

ABSTRACT:

BACKGROUND OF THE INVENTION
1. Field of the Invention
The present invention relates to computers and computer software. More specifically, the invention is generally related to debugging software.
2. Background of the Related Art
Inherent in any software development technique is the potential for introducing “bugs”. A bug will typically cause unexpected results during the execution of the program. Locating, analyzing, and correcting bugs in a computer program is a process known as “debugging.” Debugging of programs may be done either manually or interactively by a debugging system mediated by a computer system. Manual debugging of a program requires a programmer to manually trace the logic flow of the program and the contents of memory elements, e.g., registers and variables. In the interactive debugging of programs, the program is executed under the control of a monitor program (known as a “debugger”), commonly located on and executed by the same computer system on which the program is executed,
Some of the most difficult problems to debug are those dealing with memory management. Memory types that can be allocated by modern programming languages include static, stack and heap memory. Static allocation binds variables to storage locations at compile and/or link time. Stack allocation pushes an activation frame on the computer stack when a program block prepares to execute. This activation frame contains storage for variables within the scope of execution for the program block. Once the program block completes, the activation frames pop from the stack. Variables stored in the activation frame are not saved from one activation of the block to the next. Heap allocation allows memory for variables to be allocated and deallocated in any order and these variables can outlive the procedure that created them. Once memory is deallocated it is available for reallocation for another use.
During execution of a program, heap storage (in the form of memory blocks) is dynamically allocated and deallocated. Illustratively, in the C programing language allocations are made by malloc statements and deallocations are made by free statements. Memory blocks allocated from heap are accessed by pointers. Various pointer types are known in the art.
A problem occurs when the pointers to a block become obsolete (i.e., no pointers reference the block) but the block remains intact. Such a condition results in loss of available memory. One common mechanism used to remedy this problem is garbage collection. A garbage collector is a run-time component that automatically reclaims heap storage when are no pointers to it.
However, garbage collection is a significant drain on the operation of a system. For this reason, many programming languages such as C and C++ do not provide this feature. Accordingly, programmers using such languages are required to manage memory directly. Such self-management results in problems including freeing memory too early and inadvertently continuing to write to a block which has previously been freed. Freeing memory too early becomes particularly troubling when the memory is reallocated by a second routine which initializes it and then tries to use it. Because the block is still being written to by a routine other than the second routine, the second routine may retrieve corrupted data upon accessing the block. The problem is exacerbated when the application has many threads using the heap.
Therefore, there is a need for a method, article of manufacture and system adapted to address the problems associated with memory management.
SUMMARY OF THE INVENTION
The present invention generally provides an apparatus, program product, and a method for debugging computer programs that address the problems associated with memory management.
One aspect of the invention provides a method for generating allocation and deallocation history information. The method comprises providing one or more functions in code space comprising at least one of a memory allocator and a memory deallocator; recording each call to the one or more functions to generate allocation/deallocation history information for the one or more functions; and allowing a user to retrieve the allocation/deallocation history information.
Another aspect of the invention provides a signal bearing medium containing a program which, when executed by one or more processors, performs the method described above.
Another aspect of the invention provides a computer system comprising an output device, a memory device and one or more processors configured to execute one or more programs. When executed, the one or more programs perform the method described above.
Another aspect of the invention provides a method for managing memory available for dynamic allocation during execution of code including a plurality of memory allocators and a plurality of memory deallocators. The method comprises, for each deallocator called to free a memory block, determining an associated allocator responsible for allocating the memory block; recording association information identifying a relationship between each deallocator called and each associated allocator. In one embodiment, the method further comprises providing output representing the recorded information.
Still another aspect of the invention provides a method for managing memory available for dynamic allocation during execution of code containing a plurality of memory allocators and a plurality of memory deallocators. The method comprises allowing a user to establish a relationship between one or more of the memory deallocators and one or more of the memory allocators, wherein the relationship requires that memory space allocated by the one or more allocators is freed by the one or more deallocators. The method further comprises allowing the code to execute and, upon a call to the one or more deallocators to free a memory space, determining whether the relationship is violated. If so, the user is notified.
Yet another aspect of the invention provides a method for managing memory available for dynamic allocation during execution of code containing a plurality of memory allocators and a plurality of memory deallocators. The method comprises setting an upper limit on the amount of memory space an allocator can allocate during execution the code and, during execution the code, tracking the amount of memory space allocated by the allocator. If the amount of memory space allocated exceeds the limit a user is notified.
Yet another aspect of the invention provides a method for managing memory available for dynamic allocation during execution of code containing a plurality of memory allocators and a plurality of memory deallocators. The method comprises parsing a user-supplied command for a hexadecimal view of a memory space; formatting hexadecimal memory information according to whether memory is allocated or free; and outputting the hexadecimal memory information to an output device in a hexadecimal format.


REFERENCES:
patent: 5109336 (1992-04-01), Guenther et al.
patent: 5111384 (1992-05-01), Aslanian et al.
patent: 5408650 (1995-04-01), Arsenault
patent: 5491808 (1996-02-01), Geist, Jr.
patent: 5651136 (1997-07-01), Denton et al.
patent: 5652899 (1997-07-01), Mays et al.
patent: 5689707 (1997-11-01), Donnelly
patent: 5721917 (1998-02-01), Elliott et al.
patent: 5835701 (1998-11-01), Hastings
patent: 5842019 (1998-11-01), Kolawa et al.
patent: 5907709 (1999-05-01), Cantey et al.
patent: 5920876 (1999-07-01), Ungar et al.
patent: 6470436 (2002-10-01), Croft et al.
“OneLook® Search results: modulate,” [online] [accessed Dec. 11, 2002], Retrieved from Internet <URL: http://www.onelook.com/?w=modulate&ls=1>, pp. 1-2.*
Randy Sargent et al., “ARC Development System User's Guide,” [online] May 6, 1996 [accessed Dec. 10, 2002], Retrieved from Internet <URL: http://www.newtonlabs.com/arc/manual/arc_toc.html>, pp. 1-13.*
Andrew C. Staugaard, Jr., “Structured and Object-Oriented Techniques,” 1997, Prentice-Hall, Inc., 2nded., pp. 58

LandOfFree

Say what you really think

Search LandOfFree.com for the USA inventors and patents. Rate them and share your experience with other people.

Rating

Debugging methods for heap misuse does not yet have a rating. At this time, there are no reviews or comments for this patent.

If you have personal experience with Debugging methods for heap misuse, we encourage you to share that experience with our LandOfFree.com community. Your opinion is very important and Debugging methods for heap misuse will most certainly appreciate the feedback.

Rate now

     

Profile ID: LFUS-PAI-O-3117439

  Search
All data on this website is collected from public sources. Our data reflects the most accurate information available at the time of publication.