PRB: Fatal Error C1059: Out of Near Heap Space

ID Number: Q42793

5.00 5.10 6.00 6.00a 6.00ax 7.00 | 5.10 6.00 6.00a

MS-DOS | OS/2

Summary:

SYMPTOMS

In Microsoft C versions 5.0, 5.1, 6.0, 6.0a, 6.0ax, and C/C++

version 7.0, the following command line

cl /Zg filename.c

uses the /Zg compiler option to generate function declarations from

the function definitions. This option can cause the following

error:

c1059: out of near heap space.

RESOLUTION

You may be able to free more space on the near heap by invoking the

compiler in two passes, as follows:

cl /P filename.c

cl /Zg /c /Tc filename.I

The first pass processes the preprocessor statements and produces

an intermediate file. The second pass generates the function

declarations from the intermediate file.

Both the preprocessor and the compiler /Zg option use the near

heap. The preprocessor uses the near heap to evaluate macro

expansions. The compiler /Zg option uses the near heap while

producing the function declaration listing.

Another alternative that might work is to use C version 6.0ax with

the /EM switch. Version 6.0ax is a MS-DOS-extended version of the

compiler that comes on a disk labeled "Supplemental Tools." C/C++

7.0 is 32-bit MS-DOS-extended and must use this memory.

Additional reference words: 5.00 5.10 6.00 6.00a 6.00ax 7.00