Document 1300 Memory Management Description: Memory Management Overview The purpose of a memory management system is to effectively manage the Random Access Memory (RAM) available on your computer and to maximize memory in which to load your applications. When personal computers were first introduced, they operated with as little as 64 kilobytes (Kbytes) of RAM. However, as PCs became more sophisticated and powerful, so did the application programs that ran on them. Today, modern applications frequently require 540 Kbytes of memory, or more, to load. Ten years ago, that amount of required RAM would have seemed vastly excessive. Many common configurations do not have sufficient memory for proper fractioning of large applications. And, although today's computers typically have over 1 Mbyte of RAM available, only a portion of the first 640 Kbytes are available for DOS applications. Device drivers and TSRs are also typically loaded into this area, reducing the memory available for an application. Memory management software is designed to overcome the problem of insufficient conventional memory. The DR DOS memory management system is called MemoryMAX. The DR DOS MemoryMAX System The term MemoryMAX describes the collection of device drivers and commands that are used for memory management under the DR DOS 6.0 operating system to take advantage of all RAM memory available on your computer. The MemoryMAX system is designed to free-up as much conventional memory as possible. It achieves this goal by utilizing certain previously unused areas of high and lower memory and by remapping and moving other memory areas. The MemoryMAX system extends the amount of memory available to applications, so that even with network drivers and TSRs loaded, there can still be 620 Kbytes, or more, conventional memory available. However, the exact amount of additional memory that MemoryMAX provides is dependent on your particular system's configuration. The MemoryMAX system consists of three device drivers and six commands. The MemoryMAX device drivers and commands are detailed in Chapter 11 of the DR DOS 6.0 User Guide, "Customizing your System". This table lists MemoryMAX drivers and features by various hardware configurations. MemoryMAX Features Available with Hardware/Device Driver Combinations ________________________________________________________________________ Applicable | Driver | LIM | DR DOS Kernel | XMS | DRDOS Hardware | | | Kernel Relocation | | UpperMemory ------------------------------|-------------------|------|-------------- 386sx, 386 |EMM386.SYS | YES | YES | YES | YES or 486 | | | | | ------------|-----------|-----|-------------------|------|-------------- 386sx,386, |HIDOS.SYS | | | | or 486, |with Third-| ? | YES | YES | N/S |Party XMS | | | | |Memory Mgr | | | | ------------|-----------|-----|-------------------|------|-------------- IBM PS/2 |EMMXMA.SYS | YES | N/S | N/S | N/S 80286 with | | | | | IBM XMA card| | | | | ------------|-----------|-----|-------------------|------|-------------- 80286 with | HIDOS.SYS | N/S | YES | YES | N/S Extended Mem| | | | | ------------|-----------|-----|-------------------|------|-------------- 80286 with | HIDOS.SYS | N/S | YES | YES | YES Mappable | | | | | Shadow Ram | | | | | with Ext | | | | | Memory | | | | | ------------|-----------|-----|-------------------|------|-------------- 80286 with | HIDOS.SYS | N/S | YES | YES | YES Mappable | | | | | Shadow Ram | | | | | No Extended | | | | | Memory | | | | | ------------|-----------|-----|-------------------|------|-------------- 80286 with | HIDOS.SYS | N/S | YES | YES | YES NeAT, LeAP, | | | | | or SCAT | | | | | ------------|-----------|-----|-------------------|------|-------------- 80286 with | HIDOS.SYS | YES | YES | YES | YES LIM 4.0 | with third| | | | driver and | party | | | | extended | driver | | | | memory | | | | | ------------|-----------|-----|-------------------|------|-------------- 8088/8086/ | HIDOS.SYS | YES | YES | YES | YES 80286 with | with third| | | | LIM 4.0 EMS | party | | | | card and no | LIM 4.0 | | | | extended | driver | | | | ------------|-----------|-----|-------------------|------|-------------- Supported feature = YES Unsupported feature = N/S ? = This entry depends on the features offered by third-party memory manager If upper memory is not supported, HIDEVICE, HIBUFFERS, HIINSTALL, and HILOAD commands have no effect. HIDOS=ON|OFF might be supported if the third-party memory manager allocates XMS upper memory blocks (UMBs). MemoryMAX System Commands and Drivers The following is a listing and brief description of the components of the MemoryMAX memory management system. Refer to the DR DOS 6.0 User Guide for a complete description of each of these features and commands. EMM386.SYS EMM386.SYS is a device driver that allows the DR DOS 6.0 operating system to make better use of the memory available on Intel i386, i386SX, and i486-based computers. Using EMM386.SYS, you can use LIM 4.0 expanded memory without the need for special add-on cards; relocate the DR DOS operating system kernel to upper or high memory, and enable upper memory to be used for TSRs, device drivers and operating system data structures by using the /AUTOSCAN, /INCLUDE, /EXCLUDE, and /USE options. You can also add up to 96 Kbytes to conventional memory using the /VIDEO option. HIDOS.SYS If you have an Intel 80286-based computer with extended memory, you can use the HIDOS.SYS driver to relocate the DR DOS operating system kernel to high memory (see the /BDOS option). On computers that support Shadow RAM, HIDOS.SYS relocates the kernel to upper memory, and enables you to load TSRs, drivers and operating system data structures into upper memory. Using the /VIDEO option, you can also add up to 96 Kbytes to conventional memory. Example config.sys entry: DEVICE=C:\DRDOS\HIDOS.SYS /BDOS=AUTO HIDOS.SYS can also work in conjunction with LIM 4.0 expanded memory (EMS) device drivers to provide upper memory support on 8088/8086/80286 computers. This feature is detailed in the readme file or Release Notes. Note: The HIDOS.SYS driver should not be confused with the similarly-named DR DOS MemoryMAX "HIDOS = ON/OFF" command (see below). EMMXMA.SYS Use this driver on PS/2 80286 computers with IBM XMA and 100% compatible memory cards, to convert memory from extended to LIM expanded memory. Example config.sys entry: DEVICE=C:\DRDOS\EMMXMA.SYS /FRAME=D000 Note: The EMMXMA.SYS driver can be used only on PS/2 computers, and you cannot use the EMMXMA.SYS driver with any third-party memory managers (e.g., the Qualitas 386/MAX, or the Quarterdeck Expanded Memory Manager 386). You can use HIDOS.SYS following EMMXMA.SYS to obtain upper memory support. The MemoryMAX commands listed below can be used when upper memory is supported by loading the EMM386.SYS or HIDOS.SYS drivers in the config.sys file. HIBUFFERS Use HIBUFFERS to specify the number of memory buffers that the DR DOS 6.0 operating system uses. HIBUFFERS performs the same function as BUFFERS, except that HIBUFFERS allocates as many buffers as possible into high memory rather than conventional memory. The following entry in your config.sys file sets the number of buffers to 20 and forces the DR DOS 6.0 operating system to allocate as many as possible from high memory. Example config.sys entry: HIBUFFERS = 20 HIDEVICE The HIDEVICE command loads specified device drivers into upper memory. If the device is unable to load into upper memory using HIDEVICE, it will be loaded into conventional memory. The following command loads the ANSI.SYS device driver into upper memory: HIDEVICE=C:\DRDOS\ANSI.SYS HIDOS The HIDOS command relocates as much of the DR DOS operating system data structures as possible into upper memory. The default is OFF. Example config.sys entry: HIDOS=ON HIINSTALL The HIINSTALL command loads specified TSRs into upper memory. If there is insufficient upper memory for the specified TSR, it is loaded into conventional memory. Although similar to the HILOAD command (see below), HIINSTALL must be loaded via the config.sys file. Use HIINSTALL when you want a TSR permanently loaded at boot time because of best memory allocation (see the example in Chapter 2). The following command installs the CURSOR program into upper memory: HIINSTALL=C:\DRDOS\CURSOR.EXE Notice that you must give the full path name to the program and its extension (.com or .exe). HILOAD HILOAD loads specified TSRs and network drivers into upper memory. HILOAD is similar to the HIINSTALL command (which must be loaded using the config.sys file), but can be executed from the command line or from the autoexec.bat or other batch file. Before using HILOAD, you must be sure that upper memory has been enabled with the MEMMAX +U command. For example, C:> HILOAD C:\LAN\NET3 MEMMAX The MEMMAX command selectively enables and disables those enhanced memory areas provided by the DR DOS 6.0 operating system that might conflict with some applications. By using the MEMMAX +V switch, MEMMAX also enables extra memory if it has been reserved in the video adapter area by EMM386.SYS or HIDOS.SYS. You can execute the MEMMAX command from the command line or a batch file (see Chapter 10 of the DR DOS 6.0 User Guide). Note: If you enabled the video adapter area by using MEMMAX +V, you must use the MEMMAX -V command to release this memory before loading graphics applications. The HIDOS.SYS and EMM386.SYS device drivers can increase the conventional memory available to applications by using upper memory. However, some programs fail because they do not expect to find memory in this region. MEMMAX allows you to selectively enable and disable upper and lower memory from the command line or from batch files. MEMMAX +U and -U will respectively enable and disable upper memory. The DR DOS 6.0 installation will place the command "MEMMAX -U > nul" onto the autoexec.bat file. The "> nul" disables the display of the MEMMAX status message on the screen. MEMMAX -L and +L will respectively disable and enable the first 64 Kbytes of conventional memory. This region is termed "low memory". Usually the operating system resides in low memory; however, by using the DR DOS 6.0 MemoryMAX features, most of this area can be made available for running applications. Some applications were written using packing utilities that become confused when run in this low memory. If this happens, the following message appears: "Packed file is corrupt". To correct this situation, use the MEMMAX -L command to disable low memory before running the application. After exiting the application, use MEMMAX +L to enable the low memory area once again. Example: The following example shows how you can use the MEMMAX command in a batch file that loads network drivers into upper memory. The example assumes that you have already loaded a DR DOS 6.0 device driver that supports upper memory. REM * * * MEMMMAX to open upper memory * * * MEMMAX +U HILOAD C:\LAN\IPX HILOAD C:\LAN\NET3 REM * * * * Disable lower memory * * * MEMMAX -L I: CD LOGIN REM * * * * Reopen lower memory * * * * MEMMAX +L Conclusion While the MemoryMAX memory system works well with most application programs, you might still encounter occasional difficulty. The following chapters present the steps recommended for resolving such memory conflicts.