Subj : Re: huge memory model To : borland.public.cpp.borlandcpp From : "vYv" Date : Mon Apr 12 2004 11:27 am Thanks for your prompt reply. I found it quite informative. As regards the huge global arrays, is there any way to keep the executable size down without using malloc/farmalloc? Ultimately I am writing a fully standalone program (no calls to any operating system, I will rework the startup files for my needs) and because it only requires a couple large (>64k) arrays I was hoping to use intrinsic types rather than the normal malloc functions (bad programming practice I know, but I'd rather not write/find new malloc routines...perhaps it would be easier in the long run though). I am still in the researching phase of this hobby project. Any info will be much appreciated. Cheers vYv "Ed Mulroy [TeamB]" wrote in message news:4079f8ad$1@newsgroups.borland.com... > 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 > .