Browse Prior Art Database

Memory Corruption Debugging System

IP.com Disclosure Number: IPCOM000114706D
Original Publication Date: 1995-Jan-01
Included in the Prior Art Database: 2005-Mar-29
Document File: 6 page(s) / 311K

Publishing Venue

IBM

Related People

Hidalgo, DS: AUTHOR

Abstract

Disclosed is an invention which provides a system to effectively locate the cause of memory corruptions in programs using standard C runtime heap memory management. Errors caused by misuse of standard C heap memory management function calls may cause very misleading symptoms and their debugging can be very elusive. Specially in large programs the location and timing of symptoms caused by memory corruptions might seem very unrelated to the cause, thus making the latter very hard to find.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 16% of the total text.

Memory Corruption Debugging System

      Disclosed is an invention which provides a system to
effectively locate the cause of memory corruptions in programs using
standard C runtime heap memory management.  Errors caused by misuse
of standard C heap memory management function calls may cause very
misleading symptoms and their debugging can be very elusive.
Specially in large programs the location and timing of symptoms
caused by memory corruptions might seem very unrelated to the cause,
thus making the latter very hard to find.

      Most programs written in C language use the standard heap
memory management function calls malloc(), realloc(), calloc() and
free() to satisfy their dynamic memory requirements.  Blocks of
memory thus allocated have specific sizes whose boundaries aren't
enforced by any mechanism in the program, the C runtime library or in
the operating system.  Furthermore, this family of memory management
functions require but don't enforce that an address returned by the
allocation functions be exactly the same as that passed to the free()
function.  When a program violates any of those conditions, the
effects might not be noticed until later in the program execution,
and even then the symptoms might be misleading and intermittent.  All
of this makes for software bugs that are very hard to find, although
very easy to fix once they've been identified.  Therefore, there is a
large need for algorithms, methods, and tools that facilitate the
debugging of this type of problems.

      The facility here described has already been proven very useful
numerous times, helping accurately and promptly find heap memory
corruptions that could not be tracked with other available tools
(i.e., compiler debug heap memory manager, Theasus, source debuggers
alone, kernel debugger, etc.).  This has been particularly true in
the tracking of memory corruption bugs in very large programs that
run for long periods of time.

      The described Memory Corruption Debugging System is made up of
the elements further described in detail next:
  1.  Algorithm to implement debug heap memory manager: This facility
       provides an algorithm for a simple heap memory manager that
can
       be used to find the causes for memory corruptions in programs
       using the malloc() family of heap memory management functions.
A
       memory manager built with this algorithm is only to be used
       during debugging sessions and never during production.
        The debug heap memory manager algorithm is based on a
       common linear free-list suballocation algorithm, which
allocates
       segments of private system memory, tracks the free blocks
through
       a link list, uses first- fit strategy to satisfy malloc()
       requests, splits free blocks when the left over free block is
at
       least 16 bytes, and freed blocks are simply added to the head
of
     ...