The Dynamic Memory Management System (DMMS) is a computer program that was developed in response to some major shortcomings of dynamic-memory- management subsystems of typical operating systems. It is designed for use with the VxWorks operating system, but is easily ported to other operating systems.

The shortcomings in question are the following:

  • Memory fragmentation — the waste of storage space that occurs when many small blocks of storage space (buffers) are scattered randomly throughout a memory pool and the memory-management component of software is unable to coalesce these small buffers into a larger buffer;
  • Memory leak — progressive loss of storage space that occurs because an error in the storage-allocation component of software causes a failure to deallocate memory space that is no longer needed for the task at hand;
  • Limited or no visibility into usage of dynamic memory; and
  • Unreported overwriting of allocated memory buffers.

DMMS is designed to overcome these shortcomings while maintaining a simplistic interface and providing rapid execution. DMMS offers the advantages of the core memory-partition-manager component of VxWorks; namely, ease of implementation and rapid (taking tens of microseconds or less in typical cases) allocation and deallocation of buffers. DMMS enables monitoring of usage of dynamic memory and integrity of dynamic memory at buffer-release time; these features enable the user to fine-tune DMMS to obtain the highest possible performance and to become aware of gaps in the integrity of dynamic data buffers.

Going beyond what is offered by VxWorks, DMMS offers the following additional features:

  • Memory is allocated according to the buddy system instead of a first-fit algorithm. In the buddy system, buffers are allocated in sizes that are always powers of two, so that they can readily be joined and/or split. Unused smaller buffers that have been made by splitting larger ones are made available for allocation. The net effects of the buddy system are to prevent fragmentation of the memory pool and to contribute to rapidity of allocation and deallocation.
  • Freed blocks are coalesced only when necessary and only to the extent necessary. This practice offers a timing advantage over the older practice of coalescing buffers as much as possible whenever a buffer is freed.
  • The user is notified of writing data past the end of a buffer when deallocation of the buffer is requested. During development, such overwriting is a frequent error that is sometimes difficult to identify without the help of this feature of DMMS.
  • The identity of the task that requested a dynamic buffer is made known. This information can be helpful in finding and correcting a software component that causes memory leak.
  • Information on the "high-water usage" (maximum number used) of buffers of each size is made available. This information can be used in fine tuning to reduce the size of the overall dynamic buffer pool.

This work was done by Ron Phillips of Sverdrup Technology, Inc., for Marshall Space Flight Center. For further information, please contact

Sverdrup Technologies, Inc.,
620 Discovery Drive,
Huntsville, AL 35806,
Telephone No. (256) 971-9425.

MFS-31287


NASA Tech Briefs Magazine

This article first appeared in the July, 2000 issue of NASA Tech Briefs Magazine.

Read more articles from the archives here.