jwang@smu.edu (Jainbai Wang) (12/03/89)
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. First of all, the program does not fall into the second case since it is a symbolic processor (a translator) rather than a heavy computing program. Secondly, it is a MKS YACC generated program and therefore difficult to be broken into smallers. There are totally less than 450 symbol defined and the program is about 2200 lines. As I understand from the above statement and the fact that the error happens at compile time, instead of run-time, it hits compilers symbol table limitation. 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. SOME ONE PLEASE GIVE A HINT ON HOW TO SOLVE IT ! Thanks in advance.
hdan@walt.cc.utexas.edu (Dan Higdon) (12/04/89)
In article <16013@pollux.UUCP> jwang@smu.edu (Jainbai Wang) writes: >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. > What is sounds like to me, is not that you are hitting a compiler limit, but rather that you have more than 64k worth of "global scope" data in your source file. The number of symbols defined is probably irrelevant, but their SIZE isn't. The only way I can think of to solve this problem is to find some of the larger elements declared outside of any function and move them into a separate "data" file, recompiling both in Large Model (to allot yorself another segment), and linking them. MSC puts all global data from the same file in the same segment, and you get an error if you have more than 64k in any ONE file, although in Large Model, you can have more than 64k through MULTIPLE FILES. Hope this answers more questions than it causes! hdan@sleepy.cc.utexas.edu (Really Dan Higdon) Any opinions I state must be mine, as I'm not telepathic!
bryan@stiatl.UUCP (Bryan Donaldson) (12/04/89)
jwang@smu.edu (Jainbai Wang) writes: >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. >[deleted] >SOME ONE PLEASE GIVE A HINT ON HOW TO SOLVE IT ! >Thanks in advance. In the documentation file optionially[sp?] set up called \source\doc\readme.doc you'll fin a message concerning this very problem. The gist of it is : use the C1L.exe first pass for the compiler. Do so by using the /B1 switch like so : CL /B1 <path/\C1L.EXE <sourcefile>.c This should take care of your problems. BGD -- Bryan Donaldson gatech!stiatl!bryan Sales Technologies, Inc 3399 Peachtree Rd, NE Atlanta, GA (404) 841-4000
marc@metapyr.UUCP ( The Karate Kid ) (12/04/89)
This C compiler has two pass one processors. They are c1s and c1l. If you copy the c1l to c1.exe you should have no more problems. ------------------------------------------------------------------------------- "tired and shagged out from a prolonged squawk" - mpfc the parrot sketch
hollen@eta.megatek.uucp (Dion Hollenbeck) (12/04/89)
From article <16013@pollux.UUCP>, by jwang@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@megatek.uucp
tat@pccuts.pcc.amdahl.com (Tom Thackrey) (12/05/89)
In article <16013@pollux.UUCP> jwang@smu.edu (Jainbai Wang) writes: >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. > The compiler has run out of RAM. Remove all your TSRs and minimize DOS's buffers and device drivers to increase the available RAM space. -- Tom Thackrey sun!amdahl!tat00 [ The opinions expressed herin are mine alone. ]
Dennis.Schmitz@f1505.n106.z1.fidonet.org (Dennis Schmitz) (12/05/89)
In an article of <2 Dec 89 22:32:36 GMT>, jwang@smu.edu (Jainbai Wang) writes:
JW> Fatal error C1059 : out of near heap space
...
JW>SOME ONE PLEASE GIVE A HINT ON HOW TO SOLVE IT !
In addition to the reasons you gave, this is also a symptom of memory hogging by network or CD-ROM drivers.
Later,
dEN
bryan@quame.UUCP (Bryan A. Woodruff) (12/07/89)
In article <16013@pollux.UUCP> jwang@smu.edu (Jainbai Wang) writes: >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. > Which version of MSC are you using... if 5.1 and you are using the LARGE memory model, you may have problems with near default data segments. You can fix this by setting the /Gt switch... syntax is /Gt n where n is the largest size of strings (constant and static data) that will be stored in the near segment... Play with the value, eventually you will find a value that works for you. My /Gt switches are set to 20. Bryan Woodruff, Product Manager, Quality America, Inc.