Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!cs.utexas.edu!sun-barr!decwrl!henry.jpl.nasa.gov!elroy.jpl.nasa.gov!forsight!jato!mars!kaleb From: kaleb@mars.jpl.nasa.gov (Kaleb Keithley) Newsgroups: comp.lang.c Subject: Re: Compiler-heap woes.... Message-ID: <2453@jato.Jpl.Nasa.Gov> Date: 27 Dec 89 22:17:50 GMT References: <101850003@hpcvlx.cv.hp.com> Sender: news@jato.Jpl.Nasa.Gov Reply-To: kaleb@mars.UUCP (Kaleb Keithley) Organization: Jet Propulsion Laboratory, Pasadena, CA. Lines: 38 In article <101850003@hpcvlx.cv.hp.com> billf@hpcvlx.cv.hp.com (Bill F. Faus) writes: >I am attempting to compile in a lot of literal text and hex info >into a Microsoft 5.1 C program. The compiler seems to choke after >about 40K of literal info: > > char *ptr[] = {"string-1", "string-2", ..., "string-1000"}; > I'm in the wrong building to double check the books, but, since Intel segmented architecture severely limits any structure to 64K, and MSC5.1 is probably trying to put all your strings in one segment, plus other runtime string literals, and your stack... MSC memory model looks something like this... ----------------- | code | segments 1..n ----------------- | data | \ ----------------- \ | near heap | } 1 segment on small (default) model ----------------- / | stack | / ----------------- | far heap | ----------------- Only work around that I know of is to use the large memory model, compile all your string literals in a separate module, declare them extern in all the other modules, and let the linker do its' thing... Or try whichever of the mid-sized memory models that allows unlimited data, I can never remember whether it's compact or medium; you'll still want to have the strings in a separate module and link it. Chewey, get us outta here! kaleb@mars.jpl.nasa.gov (818)354-8771 Kaleb Keithley