sun@me.utoronto.ca (Andy Sun Anu-guest) (01/05/90)
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? Andy -- _______________________________________________________________________________ Andy Sun | Internet: sun@me.utoronto.ca University of Toronto, Canada | UUCP : csri.toronto.edu!me.utoronto.ca!sun Dept. of Mechanical Engineering | BITNET : sun@me.utoronto.BITNET
kaleb@mars.jpl.nasa.gov (Kaleb Keithley) (01/06/90)
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