Alloca, FSF software assumptions (was: Re: Are yacc parsers portable ?)

Rob McMahon cudcv at warwick.ac.uk
Mon Aug 8 07:40:59 AEST 1988


In article <10501 at stb.UUCP> michael at stb.UUCP (Michael) writes:
>Actually, alloca() isn't that big of a problem. Annoyance, yes, but you
>can get a PD version of alloca that is nearly identical and 98%+ portable,
>and I've seen completely compatible subroutines for ibm's, 68K's, pdp's, etc.

If this is the same alloca() that Gould supply with their Unix, UTX-32, it has
big problems with the GNU software.  When you call this version, it frees any
memory that was allocated from further up the stack.  Quite often, though, it
is called repeatedly at the same level, and the memory is never freed, as in:

	for (long loop) {
	  ...
	  func ();
	}

	func ()
	{
	  alloca (much memory);
	  ...
	}

Compiling the gcc parser using this alloca, the compiler ran out of swap space
space and died.  (We had ~40M swap space, and there was one other large (10M)
job running and not much else.)

Rob
-- 
UUCP:   ...!mcvax!ukc!warwick!cudcv	PHONE:  +44 203 523037
JANET:  cudcv at uk.ac.warwick             ARPA:   cudcv at warwick.ac.uk
Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England



More information about the Comp.lang.c mailing list