Check Environment Memory Allocation in MS-DOS 6.22

This article explains how to identify environmental memory allocation usage in MS-DOS 6.22 using built-in system utilities. It details the exact command-line syntax required to inspect active memory control blocks, explains how to locate the environment segments in the output, and provides practical methods for managing environment space limitations.

The Command Syntax

To view detailed memory allocation—including the memory reserved for environment variables—use the MEM command with the debug switch:

MEM /D

Because this command produces multiple screens of detailed technical output, you should pair it with the pause switch (/P) or pipe it to the MORE utility:

MEM /D /P

or

MEM /DEBUG | MORE

Locating Environment Memory in the Output

When you run MEM /D, MS-DOS 6.22 displays all allocated Memory Control Blocks (MCBs) in conventional and upper memory. To find your environment memory allocation:

  1. Look through the output for entries associated with COMMAND (the command interpreter) or any resident utility programs.
  2. Check the Type column for entries explicitly designated as Environment.
  3. Note the Total Size column for that block. This value indicates the exact amount of conventional memory currently allocated to hold environment variables (such as PATH, PROMPT, and custom variables).

For example, a typical entry appears in this format:

Segment   Total        Name         Type
-------  ---------  ------------  -------------
 00FD7     256 (0K)   COMMAND       Environment

In the example above, segment 00FD7 holds 256 bytes of memory dedicated to the master environment.

Adjusting Allocated Environment Space

By default, MS-DOS 6.22 allocates 256 bytes for the master environment. If you encounter the error message Out of environment space, you can increase this allocation by adding or modifying the SHELL command in your CONFIG.SYS file:

SHELL=C:\DOS\COMMAND.COM C:\DOS\ /E:512 /P

The /E:size switch defines the environment size in bytes, accepting values from 160 to 32768. After saving CONFIG.SYS and rebooting the system, rerun MEM /D /P to confirm the new environment memory allocation.