Article ID: 67194 - View products that this article applies to.
This article was previously published under Q67194
When you attempt to run a very large program in MS-DOS, the error "Program Too Large For Memory" may occur. MS-DOS runs in real mode, which does not allow more than 640K of memory for applications. This article discusses possible methods to circumvent this limitation. These methods include using the OS/2 operating system instead of DOS, direct-access disk file(s) for data storage, ALLOCATABLE arrays, and overlays.
Using Expanded and Extended Memory with Microsoft FORTRANSome DOS applications can use an expanded memory manager (EMM) driver program and expanded memory board(s) to access memory beyond the 1 MB limit of conventional memory. Microsoft FORTRAN, however, does not have the capability to use expanded memory. It can utilize extended memory (above 1 MB), but only when used with the OS/2 operating system and protected mode libraries. Extended memory is the term used to refer to the memory at physical addresses above 1 MB that can be accessed by an 80286 or 80386 CPU in protected mode.
Using a Direct Access Disk File to Store Large Amounts of DataA disk drive can be used to store large amounts of data in a direct- access disk file, thus freeing up the memory that would otherwise be used by the data. By using a direct-access file, records can be read from or written to in any order, simulating the use of an array. If expanded or extended memory is available, it can be used for a RAM drive. By using a RAM drive, I/O access to the data is much faster than when using a fixed disk drive.
Using Allocatable Arrays in FORTRAN Version 5.00An ALLOCATABLE array is an array that is dynamically sized at run time by using the ALLOCATE statement and the ALLOCATABLE attribute (see pages 21-25 of the "Microsoft FORTRAN Reference" manual). The ALLOCATE statement (see pages 113-114 of the "Microsoft FORTRAN Reference" manual) establishes the upper and lower bounds of each ARRAY dimension and reserves sufficient memory. The array can then be DEALLOCATED at run time by using the DEALLOCATE statement (see page 143 of the "Microsoft FORTRAN Reference" manual) to free memory for use by other arrays.
Using Overlays in FORTRAN Versions 4.00, 4.01, 4.10, and 5.00Overlays (see pages 366-367 of the "Microsoft FORTRAN Reference" manual for versions 5.00 and pages 258-260 of the "Microsoft FORTRAN CodeView and Utilities User's Guide") allow several program modules to use the same memory area. When needed, a module or group of modules is loaded into memory from the disk. Module access time can be shortened if a RAM drive is used to store the executable. Modules that are to be overlaid are enclosed in parentheses. CODE (but NEVER DATA) is overlaid. Note: If the program consists of mostly DATA, then this procedure will be of little help.
The following example is for versions 4.00, 4.01, 4.10, and 5.00:
At LINK command line: LINK A (B C) (E F)Object modules B and C are swapped in and out of the same memory for Object modules E and F. Note: Object modules in parentheses are overlaid together so that they will be loaded into memory at the same time.
The following example is for versions 4.10 and 5.00:
At FL command line: FL MAIN.FOR (OVER1.FOR) (OVER2.FOR)FORTRAN code modules OVER1 and OVER2 are swapped in and out of the same memory location.
Article ID: 67194 - Last Review: December 1, 2003 - Revision: 2.0
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.