Software Archive
Read-only legacy content
17061 Discussions

Porting from UNIX to PC (program too big to fit in memory)

Intel_C_Intel
Employee
1,023 Views
I am porting a sizeable mixed-language (mostly Fortran) code from UNIX to PC. I used Visual Fortran Console Application to create my Windows executable (size = 776 KB) which linked and compiled fine. Upon execution, the DOS Command Prompt gives "program too big to fit in memory." When certain arrays in the code are decreased in size (thus making the program useless for us), the Command Prompt runs the program successfully with no memory errors.

The problem seems to be in accessing DOS Extended Memory or something of this nature. Is there any easy way to get around this memory problem? Thanks for any input.

Justin
0 Kudos
10 Replies
Steven_L_Intel1
Employee
1,023 Views
My guess is that you're on Windows 95. If so, please upgrade the OS to at least Windows 98. Windows 95 has a 256MB limit on the total static (code and data) size of an executable - you would have received a warning about this at link time. Windows 98, NT4-SP3 and later Windows versions don't have this limit, though you'll still get the linker warning.

Steve
0 Kudos
Intel_C_Intel
Employee
1,023 Views
I am actually on Windows NT. It was compiled with NT as the OS also.
0 Kudos
Steven_L_Intel1
Employee
1,023 Views
How big are your arrays? Do you get a warning during linking? What does it say?

By the way, there is no DOS nor "DOS extended memory" under Windows NT.

Steve
0 Kudos
Intel_C_Intel
Employee
1,023 Views
The biggest arrays are 1024x1024 and there are 2 or 3 of them. The item that is passed between the C code and Fortran code is of type char(1280000) (in C) and BYTE(1280000) (in Fortran.) Also, I get no errors when linking but I did in the past and had to ignore the "libcd.lib" library for it to compile properly.
0 Kudos
Steven_L_Intel1
Employee
1,023 Views
That all looks ok so far. Now - you say "DOS command prompt" How do you get to this prompt? Does the program run if you just double-click on it from a Windows explorer window?

Steve
0 Kudos
Intel_C_Intel
Employee
1,023 Views
Start menu --> Programs --> Command Prompt
and then a small window opens with a DOS-like C prompt.

If we just double click the executable, it opens the Command Prompt window (same as Start Menu option mentioned above) and closes it very quickly and does not produce the anticipated output files. Besides, the program usually takes a few seconds/minutes to run. Keep firing away with questions...

-Justin
0 Kudos
Steven_L_Intel1
Employee
1,023 Views
This is all very puzzling - in particular, I can't see how you would get a 'program too big to fit in memory' error unless you were actually running DOS, which you aren't.

Can you send me the EXE? Steve.Lionel@intel.com

Steve
0 Kudos
russell66
Beginner
1,023 Views
I Assume you have checked your available total RAM??

with several arrays of size 1024 * 1024 = 1M elements = 8MB each for
Doubles your program probably requres over 64 MB AVAILABLE RAM
or atleast 128 MB real memory. This is'nt much today, but 128 is the MAX
my P-II 266 will hold...
0 Kudos
Steven_L_Intel1
Employee
1,023 Views
Justin sent me his EXE - it was entirely filled with NULs! Windows didn't like that and it gives the rather cryptic error when that happens. He then sent me the sources and I was able to build it on my system.

How he ended up with a huge EXE of all NULs is beyond me...

Steve
0 Kudos
Intel_C_Intel
Employee
1,023 Views
The situation has beenr esolved. Thanks to all who offered help. Here's the conclusion: there were actually two different problems.
- problem 1, stack size was too small
-solution, increased the stack size on the Link command line using /stack:size
- problem 2, EXE file was too big
-solution, changed from debug mode to release mode and the executable shrunk considerably. perhaps I switched a setting somewhere or perhaps not. regardless, it all works now. Thanks again!
-Justin
0 Kudos
Reply