Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!rutgers!bellcore!texbell!killer!chasm From: chasm@killer.DALLAS.TX.US (Charles Marslett) Newsgroups: comp.sources.d Subject: Re: gnu egrep - realloc of 0 bytes caused failure: Memory exhausted Summary: realloc of zero is actually 64K Message-ID: <7182@killer.DALLAS.TX.US> Date: 16 Feb 89 05:52:35 GMT References: <1114@rlgvax.UUCP> Organization: The Unix(R) Connection, Dallas, Texas Lines: 22 In article <1114@rlgvax.UUCP>, dennis@rlgvax.UUCP (Dennis.Bednar) writes: > The GNU version of egrep failed to work on a CCI 6/32 > running Unix SV. The bug was traced to the fact that > realloc(p, n) was being called with n==0, given the > command line "grep abc". I did not have time to track > down the gory details as to why realloc was being called > with 0, nor why it supposedly works on other machines > (assuming that realloc is called with 0 on other machines). In porting (bringing up) gnugrep under MSDOS I ran across the fact that there is a macro at the beginning of regex.c (or perhaps dfa.c (?)) that did a realloc with a size of "1<<16", a very bad number of bytes to specify if your integers are 16 bits long. I changed it to 1<<14, and all is now functional! Does the CCI 6/32 perhaps use 16-bit integers? > -dennis =========================================================================== Charles Marslett STB Systems, Inc. <== Apply all standard disclaimers Wordmark Systems <== No disclaimers required -- that's just me chasm@killer.dallas.tx.us