Home > Commands A-M > Commands M

MEM


Description | Syntax | Parameters | Switches | Related | Notes | Examples | Errorlevels | Availability

Displays the amount of used and free memory on your computer.

You can use the MEM command to display information about allocated memory areas, free memory areas, and programs that are currently loaded into memory.


Syntax

MEM [/P[ROGRAM] | /C[LASSIFY] | /D[EBUG] | /F[REE] | /M[ODULE] programname] [/P[AGE]] [/A] [/H]

To display the status of your computer's used and free memory:

MEM


Parameters

none.


Switches
/A (v7.00 Win95)
UNDOCUMENTED Add extra line about available High Memory Area space.
/C[LASSIFY] (v5.0 Win95 NT3.5)
Lists the programs that are currently loaded into memory and shows how much conventional and upper memory each program is using. MEM /CLASSIFY also summarizes overall memory use and lists the largest free memory blocks. You can use the /CLASSIFY switch with /PAGE but not with other MEM switches. You can abbreviate /CLASSIFY as /C.
/D[EBUG] (v4.0 Win95 NT3.5)
Lists the programs and internal drivers that are currently loaded into memory. MEM /DEBUG shows each module's size, segment address, and module type, summarizes overall memory use, and displays other information useful for programming. You can use the /DEBUG switch with /PAGE but not with other MEM switches. You can abbreviate /DEBUG as /D.
/F[REE] (v6.0 Win95)
Lists the free areas of conventional and upper memory. MEM /FREE shows the segment address and size of each free area of conventional memory, and shows the largest free upper memory block in each region of upper memory. You can use the /FREE switch with /PAGE but not with other MEM switches. You can abbreviate /FREE as /F.
/H (v7.00 Win95)
UNDOCUMENTED Brief help, like /?.
/M[ODULE] programname (v6.0 Win95)
Shows how a program module is currently using memory. You must specify the program name after the /MODULE switch. MEM /MODULE lists the areas of memory the specified program module has allocated and shows the address and size of each area. You can use the /MODULE switch with /PAGE, but not with other MEM switches. You can abbreviate /MODULE as /M.
/P[AGE] (v6.0 Win95)
Pauses after each screen of output. This switch can be used with any of the other MEM switches. You can abbeviate /PAGE as /P.
/P[ROGRAM] (v4.0 through v5.0 NT3.5)
Specifies the name, location, size, and type of each program for which memory information is to be displayed. You can abbeviate /PROGRAM as /P.

Related

For information about checking the amount of space available on a disk, see the CHKDSK command.
CLEARMEM (Resource Kit) - Clear Memory Leaks.
WINMSD - Windows NT Diagnostics (including Physical Memory).
GUI Task Manager - for all program details including Win32 applications.
TLIST - Task List.
Equivalent Linux BASH commands:
free -t - Display a summary of current memory usage and availability.


Notes
Current CMD shell only

MEM will only display details about the current CMD shell environment, programs running in a separate shell (or WIN32 programs) will not be listed - so it won't tell you anything about total memory usage.


Q126962 - Increase desktop heap memory for non-interactive processes

Increase desktop heap memory for non-interactive processes - Q126962 (SharedSection=1024,3072,3072). NOTE that NT 4 has a system wide limit of ~48MB for all desktops, so a 3M heap will allow a max 16 processes while 512K heap will allow a max 96 processes.


Q184419 - DisablePagingExecutive

DisablePagingExecutive - Q184419 (use this when >500M RAM is available).


Specifying the /PAGE switch automatically

You can use the DOSKEY program to automatically add the /PAGE switch to the MEM command. Then, each time you use MEM, it will pause after each screenful of information even if you don't type the /P switch on the MEM command-line. To do this, add the commands to your AUTOEXEC.BAT file:

    C:\DOS\DOSKEY
    DOSKEY mem=MEM.EXE $* /P

Displaying memory status

The operating system displays the status of extended memory only if you have installed memory above the 1-megabyte (MB) boundary in your system. The operating system displays the status of expanded memory only if you use expanded memory that conforms to version 4.0 of the Lotus/Intel/Microsoft Expanded Memory Specification (LIM EMS). The operating system displays the status of the upper memory area only if a UMB provider such as EMM386.EXE is installed and the command DOS=UMB is included in the CONFIG.SYS file. The operating system does not display the status of the upper memory area if you issue the MEM command while you are running Win3x.


Allocating extended memory

To allocate Interrupt 15h memory and XMS memory at the same time, use the /INT15 switch when you load the HIMEM.SYS device driver.


Examples
Getting general program and memory information

Suppose your system has both expanded memory and extended memory. To display a summary of your system's total memory -- conventional, expanded, extended, and upper -- and to display a list of programs currently loaded into memory, type:

    MEM /CLASSIFY

The results might look similar to:

    Modules using memory below 1 MB:
    Name           Total       =   Conventional   +   Upper Memory
    --------  ----------------   ----------------   ----------------
    SYSTEM      16,477   (16K)     16,461   (16K)         16    (0K)
    SETVER         784    (1K)        784    (1K)          0    (0K)
    HIMEM        1,168    (1K)      1,168    (1K)          0    (0K)
    EMM386       3,120    (3K)      3,120    (3K)          0    (0K)
    USPI14       9,120    (9K)      9,120    (9K)          0    (0K)
    COMMAND      3,680    (4K)      3,680    (4K)          0    (0K)
    SMARTDRV    37,680   (37K)     21,280   (21K)     16,400   (16K)
    MOUSE       17,088   (17K)     17,088   (17K)          0    (0K)
    NETBEUI     42,432   (41K)     41,760   (41K)        672    (1K)
    REDIR       86,064   (84K)     76,128   (74K)      9,936   (10K)
    ANARKEY     14,384   (14K)          0    (0K)     14,384   (14K)
    ZPOWER       4,368    (4K)          0    (0K)      4,368    (4K)
    ANSI         4,208    (4K)          0    (0K)      4,208    (4K)
    DRVSPACE    36,848   (36K)          0    (0K)     36,848   (36K)
    PROTMAN        128    (0K)          0    (0K)        128    (0K)
    EXP16        9,056    (9K)          0    (0K)      9,056    (9K)
    WORKGRP      4,368    (4K)          0    (0K)      4,368    (4K)
    RAMDRIVE     1,312    (1K)          0    (0K)      1,312    (1K)
    Free       472,464  (461K)    464,448  (454K)      8,016    (8K)
  Memory Summary:
    Type of Memory       Total   =    Used    +    Free
    ----------------  ----------   ----------   ----------
    Conventional         655,360      190,912      464,448
    Upper                109,712      101,696        8,016
    Reserved             393,216      393,216            0
    Extended (XMS)    15,618,928   12,424,048    3,194,880
    ----------------  ----------   ----------   ----------
    Total memory      16,777,216   13,109,872    3,667,344
    Total under 1 MB     765,072      292,608      472,464
    Largest executable program size        464,352   (453K)
    Largest free upper memory block          7,888     (8K)
    MS-DOS is resident in the high memory area.

"Reserved" is the memory located on add-on boards such as video adapter boards. "Largest executable program size" is the largest contiguous block of conventional memory available for a program. "Largest free upper memory block" is the largest area of upper memory available for a program. "MS-DOS is resident in the high memory area" indicates that the operating system is running in the first 64K of extended memory rather than in conventional memory.


Getting information about a specific program

To find out what memory a specific program module has allocated, use the MEM /MODULE command. For example, to find out what memory the WIN386 module has allocated, you would type:

    MEM /MODULE win386

If you were running WIN386, the results might look similar to:

    WIN386 is using the following memory:
    Segment  Region       Total        Type
    -------  ------  ----------------  --------
     0081D                 80    (0K)  Data
     02EF8                384    (0K)  Environment
     02F10             89,856   (88K)  Program
     0D4D0       1         96    (0K)  Data
     0D611       1      7,888    (8K)  Data
     0EFFE       2         32    (0K)  Data
                     ----------------
    Total Size: 98,336   (96K)

Some program modules, such as WIN386, allocate more than one area of memory. The MEM /MODULE command displays all the areas of memory allocated by the specified program, and shows the segment address and size of each allocation. For upper memory blocks, MEM /MODULE also shows the region number. The Type column shows how the program is using that particular area of memory. The "total size," in this case 98,336 bytes (96K), shows the total amount of memory allocated by the operating system for the specified program.


Errorlevels

none.


Availability
External
DOS
v4.0 v4.01 v4.01A v5.0 v5.0A v5.00.02 v5.001A v5.01 v5.02 v6.0 v6.10 v6.2 v6.21 v6.22 v6.23 v7.00 v7.0R1 v7.10 v8.00
Windows
Win95 Win98 WinME
Windows NT
NT3.5 NT4 NT2000