The following are definitions for terms as used in this manual.

API (Application Programming Interface)

The programmatic interface of a group of functions defined by a library. The programmatic interface includes the function names and return types, the parameter types, and the calling convention.

automatic memory

Memory allocated on the stack. Such memory is de-allocated “automatically” when the scope in which it was declared exits.


A routine whose address is passed to a library or operating system function, so the callback routine may subsequently be “called back” in response to some event. Callbacks are used with SmartHeap to handle memory-related error conditions.


Memory that has been freed into private free store, but not returned to the operating system so others can use it. Such private free store is considered constipation when it will not be used by the owner of the free store. Applications should avoid constipation by controlling the size of memory pools and by shrinking pools when system memory is low.

dangling pointer

A pointer to memory that has previously been freed. If a reference to the pointer is retained, the pointer is considered “dangling.” It is an error to dereference or otherwise use such a pointer.

double freeing

Freeing the same pointer more than once. Double freeing is likely to corrupt the heap. Two common results are subsequent allocation of the same block twice or mysterious crashes at a later point in the program’s execution.

dynamic memory

Memory that is referenced with dynamic extent. That is, the memory may be allocated and freed at any time during the program’s execution.

expanded memory

A type of virtual memory accessible with Windows 2.x and 3.0 in real mode, whereby memory banks are swapped in and out of the 640K address space. Expanded memory isn’t used in Enhanced or Standard Mode, or in future Windows versions, so it isn’t applicable to SmartHeap.

extended memory

Memory that isn’t accessible from real mode on Intel 80x86 processors. When Windows is running in protected (Enhanced or Standard) mode, all application memory is extended.


The interval of time during which references to an object occur. Objects with dynamic extent may be referenced at any time between establishment (for example, allocation) and disestablishment (for example, freeing) of the object. Objects with static extent may be referenced at any time during program execution. Objects with local extent may be referenced only in the lexical scope of their declaration.

fixed memory

A memory block that is fixed at a given address. All SmartHeap allocation APIs except MemAlloc return fixed memory.

fixed-size memory

Memory blocks that have a uniform, pre-determined size. Fixed-size memory is unique to SmartHeap. If your program creates a lot of objects of the same size, you can allocate fixed-size memory for these objects and, thereby, completely avoid the problems of overhead and fragmentation.


The process by which many small chunks of memory become trapped between larger chunks as a result of memory allocations overlapping in size and extent. If memory becomes badly fragmented, it may be impossible to allocate a large block, because all free memory is spread throughout the address space in small, discontiguous chunks.


See “leakage.”

GDT (Global Descriptor Table)

The GDT is a data area used by the Intel 80x86 protected mode architecture for mapping selectors to segment addresses. This provides a virtual-to-physical address space translation. The purpose of the GDT is to provide a shared address space, where each process normally allocates out of a private address space maintained by its LDT. In Windows 3.x, however, all tasks share one LDT, and the GDT isn’t used at all. Future versions of Windows may separate the address spaces of applications by giving each application its own LDT and using the GDT for shared memory.


The increments by which memory is allocated. 16-bit Windows global memory has 32-byte granularity. OS/2 and NT have 4K-byte granularity for system memory allocations. SmartHeap variable-size memory has 4 byte granularity. SmartHeap fixed-size memory has 2 byte granularity for 16-bit platforms and 4-byte for 32-bit platforms. If you request an allocation whose size is not a multiple of the granularity, the actual size allocated is rounded up to the next multiple. The difference is wasted memory, unless you determine and utilize the actual rather than the requested size.


An integer that identifies an object, such as a memory block. Memory handles are used in SmartHeap to facilitate moveable memory. The memory address corresponding to the handle may change when the handle isn’t “locked.”

LDT (Local Descriptor Table)

The LDT is a data area used by the Intel 80x86 protected mode architecture for mapping selectors to segment addresses. This provides a virtual to physical address space translation. The purpose of the LDT is actually to provide a private address space to a process. In Windows 3.x, however, all tasks share the same LDT. Future versions of Windows may separate the address spaces of applications by giving each application its own LDT.


Memory that has been allocated and is no longer in use, but that hasn’t been freed. Leakage is, therefore, wasted memory. A program that leaks, by not freeing memory it has allocated, may eventually exhaust memory in the course of normal use.


In virtual operating systems, data is swapped to a page file when applications request more allocations than will fit in physical memory. The unit of memory that is swapped is a page, usually 4K in size. An application is said to have good locality if related data are stored near each other in memory, and thus likely to be on the same page and hence swapped together. If an application has many small bits of data scattered randomly throughout the address space, then many more pages will need to be swapped in and performance will suffer. You can use SmartHeap memory pools to improve locality.

memory overwrite

The result of a program writing beyond the allocated bounds of a memory object. Using an invalid subscript on an array, failing to allocate space for a trailing NUL character in a string, and incrementing a pointer past the end of the memory block it points to are all common causes of memory overwrites.

memory pool

A private free store from which related memory allocations occur. Memory pools permit memory to be partitioned for different uses. Such partitioning improves locality, which, in turn, reduces swapping. The allocations from a given SmartHeap pool may be fixed size or variable size. SmartHeap permits you to control how much memory is retained in the private free store of a given pool and control when such free memory is returned to the operating system for others to use.

moveable memory

Memory blocks that the memory manager can move in order to compact the heap, thereby overcoming fragmentation. You can allocate moveable memory in SmartHeap with MemAlloc.


The memory used for header information in each memory block. From an application’s perspective, this is wasted memory. 16-bit Windows global allocations have a 24-byte overhead; Win32 HeapAlloc allocations have overhead of 16 bytes. SmartHeap moveable allocations have a 10-byte overhead. SmartHeap small allocations (less then 256 bytes) have 1 byte overhead. Larger SmartHeap variable-size allocations have a overhead between 2 and 4 bytes, depending on platform. SmartHeap fixed-size allocations have zero overhead.


The system page is the unit used by virtual operating systems to swap data between disk and physical memory. The page size is 4K on most operating systems. The SmartHeap page size is some multiple of the system page size. You can specify this for each memory pool with MemPoolSetPageSize.


The basic unit of memory in the Intel 80x86 architecture. Memory addresses are composed of a 16-bit segment and a 16-bit offset. Thus, the largest single block that is addressable is 64K. In protected mode, the segment portion of addresses is actually a segment selector, which maps to a physical segment via the LDT.


A segment identifier, used in 80x86 protected mode to provide a virtual address that maps to a physical address stored in a descriptor table. There are two such descriptor tables: the local descriptor table (LDT) and the global descriptor table (GDT).

shared memory

Memory that is addressable by two different tasks or processes. Shared memory is typically used to exchange data between two or more cooperating tasks.

variable-size memory

Memory blocks whose size varies with each allocation. The complement of fixed-size memory, variable-size memory is used for general purpose allocations.

wild pointer

A pointer whose value is not a valid memory address. If a non-static pointer hasn’t been initialized, it will contain random bits and, therefore, be wild. A pointer to memory that was previously freed must be assumed to be wild. A bogus cast (assignment of a pointer to a non-pointer type) may result in a wild pointer.

working set

A group of memory objects that tend to be referenced frequently during a lengthy operation of a program. The concept of working sets is significant in virtual memory systems, where the operating system continually swaps portions of code and data between memory and disk. You can improve performance by allocating blocks in the same working set (such as links of the same list) from the same memory pool.

SmartHeap Programmer’s Guide