From: "A. Sinan Unur" Newsgroups: comp.os.msdos.djgpp Subject: Re: DJGPP MEM BUG? -- NOT Date: Sun, 15 Jun 1997 12:11:28 -0400 Organization: Cornell University http://www.cornell.edu Lines: 63 Sender: asu1 AT cornell DOT edu (Verified) Message-ID: <33A41430.25C0@cornell.edu> References: <33A36EAE DOT 17D4 AT tc DOT umn DOT edu> Reply-To: asu1 AT cornell DOT edu NNTP-Posting-Host: cu-dialup-0040.cit.cornell.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit CC: jawed AT tc DOT umn DOT edu To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Jawed Karim wrote: > > I really need the following code to work. Under Linux, this works > PERFECTLY. Under DJGPP I get SIGSEVs every single time. See for > yourself: > > -- > #include > > typedef struct { > int r, g, b; > int closest_fit; > } Table; let's see, sizeof(Table) is 16. > > main() > { > Table thingy[255][128]; > } > --- you are asking for 255*128*16 = 510 K of memory from the stack. AFAIK, djgpp programs have a default stack size of 256 K. you can use the program stubedit in you bin directory to change this value. that said, i do not think it is a good idea to allocate so much memory from the stack. > It doesnt crash with [255][32] but it does with [255][64]. In any > case, even with 128 it SHOULD NOT. It's not that much memory, and because with 32, you are asking for 127.5 K and with 64 K, you are asking for 255 K. it is not that much memory to allocate on the heap, but not when it comes to the stack. > under linux gcc it works. Any ideas? so, under linux, the default stack size must be larger. > Please email me directly... will do. however, i would appreciate it if you do not do the same. i can read the newsgroup fine. BTW, if you look at the trace, it tells you > Stack Fault at eip=00001559 i would urge everyone to first think before blaming djgpp, cwsdpmi etc for all their woes. -- Sinan ******************************************************************* A. Sinan Unur WWWWWW |--O+O mailto:sinan DOT unur AT cornell DOT edu C ^ http://www.people.cornell.edu/pages/asu1/ \ ~/ Unsolicited e-mail is _not_ welcome, and will be billed for. *******************************************************************