Article View: comp.sys.ibm.pc.programmer
Article #1098TC/C++ Out of memory error -- Please help!
From: Roggie Boone
Date: Tue, 06 Oct 1992 17:17
Date: Tue, 06 Oct 1992 17:17
62 lines
3459 bytes
3459 bytes
[I posted this to comp.compilers but the moderator suggested that I post to this group also.] I am receiving an "Out of Memory" fatal error while compiling a C++ program in Turbo C/C++. It is very strange though. The program is not that big -- the source file is only about 31K (and the EXE from an earlier compile was only 68K). I include <iostream.h>, <fstream.h> <iomanip.h> and < dos.h>. There is nothing fancy going on in the program. It consists mostly of if..else statements then a bunch of "cout" (ie. printf()) statements. I have a computer with 640K conventional (of which 613K is available for executing programs) and I have also configured my machine to provide 6MB of expanded memory. I have tried compiling inside the IDE and from the command line with "TCC -Qe myprog.cpp" where "-Qe" means to use all available expanded memory. I don't think the compiler is using the expanded memory because I get the same out of memory error whether I have 6MB EMS configured or not. If you can help in any way based on what was said above, I would very much appreciate it. If you want more details about the program and/or what I have tried thus far, then read on (below the signature). Roggie Boone Computer Support Staff Internet: boone@athena.cs.uga.edu Dept. of Ag and Applied Economics Internet: roggie@aisun1.cs.uga.edu University of Georgia Phone: (706) 542-2482 -------------------------- Additional Info ------------------------ The program is actually very simple. All I want it to do is read some data from a file and based on the data read, update cells in a 29x11 array of longs. I do this with about 28 if..else statements. I then want to print out the contents of the array. Again, I do this with about 28 "cout" statements based on certain conditions. Nothing fancy. Originally, I did not use an array, but instead had about 300 global variables of type int. The program compiled fine. I then changed the _TYPE_ of those 300+ variables from "int" to "long" and then I got the out of memory error!!! That struck me as odd, but I don't know the internal workings of the compiler. So I decided to create an array to hold the variables instead of having 300+ individual variables. I still got the error message. The compiler runs out of memory about 10 lines from the bottom of the program. I can comment out those last 10 lines and it compiles fine. That is when I have my computer configured for 640K conventional and 7MB XMS and I am compiling inside the IDE. When I reconfigure the computer to have 6MB EMS memory, and compile inside the IDE or with the line "tcc -Qe myprog.cpp", there is no difference. -- Roggie Boone Computer Support Staff Internet: boone@athena.cs.uga.edu Dept. of Ag and Applied Economics Internet: roggie@aisun1.cs.uga.edu University of Georgia Phone: (706) 542-2482
Technical Details
Message-ID:
<1992Oct6.171731.20774@athena.cs.uga.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!destroyer!sol.ctr.columbia.edu!emory!athena.cs.uga.edu!booneShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!destroyer!sol.ctr.columbia.edu!emory!athena.cs.uga.edu!boone From: boone@athena.cs.uga.edu (Roggie Boone) Newsgroups: comp.sys.ibm.pc.programmer,comp.lang.c Subject: TC/C++ Out of memory error -- Please help! Message-ID: <1992Oct6.171731.20774@athena.cs.uga.edu> Date: 6 Oct 92 17:17:31 GMT Sender: boone@athena.cs.uga.edu (Roggie Boone) Distribution: usa Organization: University of Georgia, Athens Lines: 62