Memory management is a complex field of computer science and there are many techniques being developed to make it more efficient. This guide is designed to introduce you to some of the basic memory, XMS, HIMEM.SYS, and the like), then you won’t find The Memory Management Reference very management issues that programmers face.
Some platforms have specific problems in dealing with memory, which are not covered in depth here. In particular, if you are looking for information on configuring memory under DOD or Windows.
This guide attempts to explain any terms it uses as it introduces the. In addition, there is a Glossary of memory management terms that giver full information; some terms are linked to the relevant entries.
Memory management is usually divided into three areas: hardware, operating system, and application (described in more detail below), although the distinctions are a little fuzzy. In most computer systems, all three are present to some extent, forming layers between the user’s program and the actual memory hardware. The memory management reference is mostly concerned with application memory management.
Hardware Memory Management
Memory management at the hardware level is concerned with the electronic devices that actually store data. This includes things like RAM and memory caches.
Operating System Memory Management
In the operating system, memory must be allocated to user programs, and reused by other programs when it is no longer required. The operating system can pretend that the computer has more memory than it actually does, and also that each program has the machine’s memory to itself, both of these are features of virtual memory systems.
Application Memory Management
Application memory management involves supplying the memory needed for a program’s objects and data structures from the limited resources available, and recycling that memory for reuse when it is no longer required. Because application programs cannot in general predict in advance how much memory they are going to requires, they need additional code to handle their changing memory requirements. Application memory management combines two related tasks:
When the program requests a block of memory, the memory manger must allocate that block out of the larger blocks it has received form the operating system. The part of the memory manager that does this is known as the allocator. There are many ways to perform allocation, a few of which are discussed in Allocation techniques.
When memory blocks have been allocated, but the data they contain is no longer require by the program, then the blocks can be recycled for reuse. There are two approaches to recycling memory: either the programmer must decide when memory can be reused (Know as manual memory management); or the memory manager must be able to work it out (Known as automatic memory management). These are both described in more detail below.
An application memory manager must usually work to several constraints, such as:
The additional time taken by the memory manager while the program is running;
Interactive pause times
How much delay interactive user observes;
How much space is wasted for administration, rounding (known as internal fragmentation). And poor layout (know as external fragmentation).