755 Subj : Re: huge memory model To : borland.public.cpp.borlandcpp From : "Ed Mulroy [TeamB]" Date : Sun Apr 11 2004 11:02 pm In large memory model the data segment in which global and static data is placed is one segment and the hardware limits a segment to 64K. In huge memory model the data segment in which global and static data is placed is still limited to 64K by the hardware. However each source file has its own data segment so, independently of if it makes good programming sense, and it rarely if ever does, one can declare more than 64K of global and static data per program. Huge global arrays are not related to huge model. They are about as easy to do in large or even small model as they are in huge. Declare a pointer to the array globally and allocated it at runtime early in main with a call to farmalloc. For example: --------------------- #include #include char huge *big_array; int main() { /* don't forget farmalloc takes an unsigned long */ big_array = farmalloc(256 * 1024UL); if (big_array == NULL) { printf("Not enough memory to run the program\n"); return 1; } ----normal program code here--- farfree(big_array); return 0; } --------------------- .. Ed > vYv wrote in message > news:4079b1ac$1@newsgroups.borland.com... > Hello Borland gurus. > > I have been fooling around with the huge memory model in > Borland 3.1 lately and have a couple questions. > > 1. If I am compiling into the huge model why do I have to > explicitely declare arrays greater than 64k as huge? > > 2. Is there a way to compile a program containing huge > global arrays without them adding to the executables size? > > Thanks in advance > vYv . 0