Browse Prior Art Database

Memory Allocation Monitoring Class

IP.com Disclosure Number: IPCOM000111972D
Original Publication Date: 1994-Apr-01
Included in the Prior Art Database: 2005-Mar-26
Document File: 2 page(s) / 36K

Publishing Venue

IBM

Related People

Burnett, T: AUTHOR

Abstract

Disclosed is a method for monitoring the number, order and size of multiple memory allocations during the execution of a program. External memory monitors cannot accurately provide this information with regard to a specific variable.

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

Memory Allocation Monitoring Class

      Disclosed is a method for monitoring the number, order and size
of multiple memory allocations during the execution of a program.
External memory monitors cannot accurately provide this information
with regard to a specific variable.

      The solution is to create a memory monitoring class that can be
easily linked into a program by a compile time switch and provide
statistics on memory allocations.  The class should contain a
replacement routine for malloc (mymalloc), a replacement routine for
free (myfree), and a report flag.  The function of mymalloc is to
return a pointer to memory allocated by use of malloc, but at the
same time, update statistics as to the number of allocations, size of
current allocation, number of bytes currently allocated, and possibly
the maximum number of bytes allocated.  Mymalloc should be passed the
number of bytes to be allocated and a small string which determines
that the allocation corresponds to a specific variable.  The myfree
routine merely frees the memory and updates the allocation statistics
accordingly.  Myfree should be passed the memory pointer to be freed
and the correspondence string.  If the report flag is on, mymalloc
and myfree should print the allocation statistics.

      Since mymalloc and myfree are included by compile time switch,
there will be no performance decrease if the new routines are not
included.  However, with the compiler switch on and a report flag...