Subject: followup: make coredumping
To: None <jtc@cygnus.com>
From: Gordon W. Ross <gwr@mc.com>
List: port-sun3
Date: 11/07/1995 16:29:07
> Date: Tue, 07 Nov 1995 11:07:14 -0800
> From: "J.T. Conklin" <jtc@cygnus.com>
> Sender: owner-port-sun3@netbsd.org
> Precedence: list
> X-Loop: port-sun3@NetBSD.ORG
> 
> >>>>> "DM" == der Mouse <mouse@Collatz.McRCIM.McGill.EDU> writes:
> DM> I built a version of make with -g, and it coredumped too, though
> DM> not at the same place.  Upon looking at the core with gdb, it
> DM> appears that it simply ran out of memory.
> 
> ...
> 
> DM> This all adds up, to me, to make running out of VM at about 8
> DM> megabytes.  This would not be interesting, except that 8 megabytes
> DM> is exactly how much RAM there is in the machine.
> 
> Note that on my machine the default datasize limit is 8MB.  You might
> want to check that first.
> 
> Also, I would think that make wouldn't be using that much memory.
> Perhaps there is a leak somewhere.
> 
> 	--jtc

One problem here is that make is not checking the return value from
malloc (I'll create a PR# for this shortly).  The places where make
does not check are as follows:

cd /usr/src/usr.bin/make/
grep malloc *.[ch] lst.lib/*.[ch] |grep -v emalloc
bit.h:        bitArrayPtr = (int *)malloc((unsigned)Bit_NumBytes(numBits)); \
main.c: *	malloc, but die on error.
main.c:	if ((p = (char *) malloc(len)) == NULL)
util.c:    char *ptr = (char*) malloc(len);
lst.lib/lstInt.h:#define	PAlloc(var,ptype)	var = (ptype) malloc (sizeof (*var))

(The above malloc calls should all be emalloc instead.)

Gordon