Helps wanted on Microsoft C compiler.

Dion Hollenbeck hollen at eta.megatek.uucp
Tue Dec 5 01:58:01 AEST 1989


>From article <16013 at pollux.UUCP>, by jwang at smu.edu (Jainbai Wang):
> When programming with Microsoft C lately, I run into a problem that the
> MSC compiler gives the following error message at compiling time :
> 
>            Fatal error C1059 : out of near heap space
> 
> The manual explains it like this :
> 
> 	   The compiler has run out of storage for items that it stores 
>            in the "near" (default data segment) heap. This usually means 
>            that your program has too many symbols or complex expressions. 
>            To correct the problem, divide the file into several smaller 
>            source files, or break expressions into smaller subexpressions.
> 
> I tried to use large memory
> mode (though it seems irrelevant) and resulted in the same. There just
> no options available to increase the size of symbol table.
> 
Your use of the large or huge memory model will be of no use at all
as you found out.  The problem is that the compiler was probably
compiled with the Medium memory model (well, maybe large) and the
compiler is using up all the heap.  What you need is the compiler 
compiled with a larger memory model, or the compiler changed so that
it uses the far heap.  Where the near heap is depends on the memory
model and compiler, but in general, it is between the top of the
data segment and the bottom of the stack.  If, like in the medium
model, data, heap and stack are in a single 64k segment, you have
a smaller heap.  Moving up to the large memory model makes your
data go in one 64k segment and the heap and stack in another.  Still
a limitation on the near heap.

The solution which is the most expandable is to use the far heap.
This is generally all the memory above the top of the stack.  You can
control how much memory is there to a degree by unloading all of your
TSR's and other garbage which are hogging memory.  Of course, this
gets nasty since you have to boot with TSR's to do your editing,
re-boot without TSR's to do your compile, boot do editing,....
ad nauseum.

Even with this explanation, it only helps you if the program YOU
are writing is running out of near heap space.  If the compiler
is running out of near heap space, the ONLY thing availble to
you  is to make your program into smaller modules.  I realize that
it may look to you that since it is YACC generated, there is
no way to do it, but let me assure, there is ALWAYS a way.  Show
what you are doing to enough people and someone will give you the
trigger to the solution.

My best suggestion is to repost this article with the question:
"How do I get YACC to generate several small source files out
of this one source file" and post it to newsgroups in which
people would most likely know about YACC, like comp.unix.wizards.
Don't give much hope for posting in PC newsgroups except for
people who read both.  This is really a technical unix question, now.


	Dion Hollenbeck             (619) 455-5590 x2814
	Megatek Corporation, 9645 Scranton Road, San Diego, CA  92121

        uunet!megatek!hollen       or  hollen at megatek.uucp



More information about the Comp.lang.c mailing list