Article View: comp.sys.ibm.pc
Article #40834Re: exceed 64K memory allocation in MS C 5.10
From: Kaleb Keithley
Date: Fri, 05 Jan 1990 16:39
Date: Fri, 05 Jan 1990 16:39
40 lines
1745 bytes
1745 bytes
In article <1990Jan4.220913.19058@me.toronto.edu> sun@me.utoronto.ca writes:
>A colleague of mine is writing a C program for image analysis and
>compile it using Microsoft C Optimizing Compiler Version 5.10. He has
>an array of 640x480 declared. When he compiled the program with the
>huge option (i.e. -AH), it gave him this "exceed 64K memory allocation"
>error and refuse to compile. How can one exceed (if it is possible at
>all) this 64K memory allocation barrier in MS C?
>
I suspect that your friend is doing something like this...
main()
{
int array[640*480];
...
}
Which is an error because MSC thinks this is an automatic variable, which
it will try to allocate on the run-time stack, which can never be bigger
than 64K.
What he should do instead is create a huge pointer to said array and use
the huge memory allocation (halloc.)
Or alternatively declare the array static, or move the array outside of
the function, either of which gets the array out of the stack and into the
DGROUP, which can be as big as you like (within limits.)
.
Chewey, get us outta here!
kaleb@mars.jpl.nasa.gov (818)354-8771
Kaleb Keithley
Technical Details
Message-ID:
<2518@jato.Jpl.Nasa.Gov>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!henry.jpl.nasa.gov!elroy.jpl.nasa.gov!jato!mars!kalebReferences:
<1990Jan4.220913.19058@me.toronto.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!henry.jpl.nasa.gov!elroy.jpl.nasa.gov!jato!mars!kaleb From: kaleb@mars.jpl.nasa.gov (Kaleb Keithley) Newsgroups: comp.sys.ibm.pc Subject: Re: exceed 64K memory allocation in MS C 5.10 Message-ID: <2518@jato.Jpl.Nasa.Gov> Date: 5 Jan 90 16:39:52 GMT References: <1990Jan4.220913.19058@me.toronto.edu> Sender: news@jato.Jpl.Nasa.Gov Reply-To: kaleb@mars.UUCP (Kaleb Keithley) Organization: Jet Propulsion Laboratory, Pasadena, CA. Lines: 40