PRB: F1901: "Program Too Large for Memory" Error (49708)



The information in this article applies to:

  • Microsoft FORTRAN Compiler for MS-DOS 4.0
  • Microsoft FORTRAN Compiler for MS-DOS 4.01
  • Microsoft FORTRAN Compiler for MS-DOS 4.1
  • Microsoft FORTRAN Compiler for MS-DOS 5.0
  • Microsoft FORTRAN Compiler for MS-DOS 5.1
  • Microsoft FORTRAN compiler for OS/2 4.1
  • Microsoft FORTRAN compiler for OS/2 5.0
  • Microsoft FORTRAN compiler for OS/2 5.1

This article was previously published under Q49708

SYMPTOMS

Compiling an application causes the compiler to generate the following message:
F1901: program too large for memory

CAUSE

One possible cause is that the application includes a DATA statement that contains an extensive amount of data. The compiler stores data in the near heap during compilation. The error occurs when the near heap is exhausted. See the Sample code below.

RESOLUTION

To address this situation, perform one of the two steps below:

  • In FORTRAN versions 5.0 and 5.1, perform the appropriate steps below to use the high-capacity FORTRAN compiler.
  • In versions of FORTRAN prior to version 5.0, modify the source code to remove the huge DATA statement. Read the required information from a data file or use assignment statements.
FORTRAN PowerStation will successfully compile the sample code below.

MORE INFORMATION

By default, the SETUP program for FORTRAN version 5.1 installs F1L.EXE into the C:\FORTRAN\BIN directory. The compiler command line is as follows:

FL /B1 F1L.EXE TEST.FOR

In FORTRAN version 5.0, copy the F1L.EXE file from the High Capacity Compiler Disk into the FORTRAN BIN directory (by default, C:\FORTRAN\BIN). The compiler command line is as follows:

FL /B1 C:\FORTRAN\BIN\F1L.EXE TEST.FOR

The following code example demonstrates this situation. If you change the array subscript in the declaration for the TMP array from 254 to 256, or if you add another data item to the source code, the program is too large for the first pass of the FORTRAN compiler to process. To address this situation, use the high-capacity FORTRAN compiler as discussed above.

Sample Code

C Compile options needed: See above
      SUBROUTINE TEST ()
      REAL TMP(254) ! LOW CC LIMIT 254
      DATA TMP / 0.0, .035, .049, .049, 0.0, 0.0, .068, .068, 0.0,
     Z         .095, .095, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, .049,
     Z         .065, .065, 0.0, 0.0, .088, .088, 0.0, .119, .119,
     Z         0.0, 0.0, 0.0, 0.0, 0.0, 0.0, .049, .065, .065,
     Z         0.0, 0.0, .091, .091, 0.0, .126, .126, 0.0, 0.0,
     Z         0.0, 0.0, 0.0, .065, .065, .083, .083, 0.0, 0.0,
     Z         .109, .109, 0.0, .147, .147, 0.0, 0.0, 0.0, .187,
     Z         .294, .065, .065, .083, .083, 0.0, 0.0, .113, .113,
     Z         0.0, .154, .154, 0.0, 0.0, 0.0, .218, .308, .065,
     Z         .065, .109, .109, 0.0, 0.0, .133, .133, 0.0, .179,
     Z         .179, 0.0, 0.0, 0.0, .250, .358, .065, .065, .109,
     Z         .109, 0.0, 0.0, .140, .140, 0.0, .191, .191, 0.0,
     Z         0.0, 0.0, .250, .382, .065, .065, .109, .109, 0.0,
     Z         .095, .095, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, .049,
     Z         .065, .065, 0.0, 0.0, .088, .088, 0.0, .119, .119,
     Z         0.0, 0.0, 0.0, 0.0, 0.0, 0.0, .049, .065, .065,
     Z         0.0, 0.0, .091, .091, 0.0, .126, .126, 0.0, 0.0,
     Z         0.0, 0.0, 0.0, .065, .065, .083, .083, 0.0, 0.0,
     Z         .109, .109, 0.0, .147, .147, 0.0, 0.0, 0.0, .187,
     Z         .294, .065, .065, .083, .083, 0.0, 0.0, .113, .113,
     Z         0.0, .154, .154, 0.0, 0.0, 0.0, .218, .308, .065,
     Z         .065, .109, .109, 0.0, 0.0, .133, .133, 0.0, .179,
     Z         .179, 0.0, 0.0, 0.0, .250, .358, .065, .065, .109,
     Z         .109, 0.0, 0.0, .140, .140, 0.0, .191, .191, 0.0,
     Z         0.0, 0.0, .250, .382, .065, .065, .109, .109, 0.0,
     Z         .095, .095, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, .049,
     Z         0.0, 0.0, .091, .091, 0.0, .126, .126, 0.0, 0.0,
     Z         0.0, 0.0, 0.0, .065, .065, .083, .083, 0.0, 0.0,
     Z         .109, .109, 0.0, .147, .147, 0.0, 0.0, 0.0, .187,
     Z         .294, .065, .065, .083, .083, 0.0, 0.0, .113, .113,
     Z         0.0, .154, .154, 0.0, 0.0, 0.0, .218, .308, .065,
     Z         .065, .109, .109, 0.0, 0.0, .133, .133, 0.0, .179,
     Z         .179, 0.0, 0.0, 0.0, .250, .358, .065, .065, .109,
     Z         .109, 0.0, 0.0, .140, .140, 0.0, .191, .191, 0.0,
     Z         0.0, 0.0, .250, .382, .065, .065, .109, .109, 0.0,
     Z         .095, .095, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, .049,
     Z         .065, .065, 0.0, 0.0, .088, .088, 0.0, .119, .119,
     Z         0.0, 0.0, 0.0, 0.0, 0.0, 0.0, .049, .065, .065,
     Z         0.0, 0.0, .091, .091, 0.0, .126, .126, 0.0, 0.0,
     Z         0.0, 0.0, 0.0, .065, .065, .083, .083, 0.0, 0.0,
     Z         .109, .109, 0.0, .147, .147, 0.0, 0.0, 0.0, .187,
     Z         .294, .065, .065, .083, .083, 0.0, 0.0, .113, .113,
     Z         0.0, .154, .154, 0.0, 0.0, 0.0, .218, .308, .065,
     Z         .065, .109, .109, 0.0, 0.0, .133, .133, 0.0, .179,
     Z         .179, 0.0, 0.0, 0.0, .250, .358, .065, .065, .109,
     Z         .109, 0.0, 0.0, .140, .140, 0.0, .191, .191, 0.0,
     Z         0.0, 0.0, .250, .382, .065, .065, .109, .109, 0.0,
     Z         .095, .095, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, .049,
     Z         .065, .065, 0.0, 0.0, .088, .088, 0.0, .119, .119,
     Z         0.0, 0.0, 0.0, 0.0, 0.0, 0.0, .049, .065, .065,
     Z         0.0, 0.0, .091, .091, 0.0, .126, .126, 0.0, 0.0,
     Z         0.0, 0.0, 0.0, .065, .065, .083, .083, 0.0, 0.0,
     Z         .109, .109, 0.0, .147, .147, 0.0, 0.0, 0.0, .187,
     Z         .294, .065, .065, .083, .083, 0.0, 0.0, .113, .113,
     Z         0.0, .154, .154, 0.0, 0.0, 0.0, .218, .308, .065,
     Z         .065, .109, .109, 0.0, 0.0, .133, .133, 0.0, .179,
     Z         .179, 0.0, 0.0, 0.0, .250, .358, .065, .065, .109,
     Z         .109, 0.0, 0.0, .140, .140, 0.0, .191, .191, 0.0,
     Z         0.0, 0.0, .250, .382, .065, .065, .109, .109, 0.0,
     Z         0.0, .145, .145, 0.0, .200, .200, 0.0, 0.0, 0.0, .281/ 
      WRITE (*,*) TMP
      END
				

Modification Type:MajorLast Reviewed:12/1/2003
Keywords:KB49708