*BSD News Article 9450


Return to BSD News archive

Received: by minnie.vk1xwt.ampr.org with NNTP
	id AA5788 ; Fri, 01 Jan 93 01:55:52 EST
Path: sserve!manuel.anu.edu.au!munnari.oz.au!uunet!pipex!bnr.co.uk!uknet!mcsun!news.funet.fi!funic!nntp.hut.fi!nntp!Petri.Wessman
From: Petri.Wessman@hut.fi (Petri Wessman)
Newsgroups: comp.unix.bsd
Subject: GNU malloc (was: gcc-2.3.2 and kernel build)
Message-ID: <PETRI.WESSMAN.92Dec31154930@lk-hp-9.hut.fi>
Date: 31 Dec 92 15:49:30 GMT
References: <RANDY.92Dec28095652@dsndata.dsndata.com> <1hqciuINN620@usenet.INS.CWRU.Edu>
Sender: usenet@nntp.hut.fi (Usenet pseudouser id)
Reply-To: Petri.Wessman@hut.fi
Organization: La Gata Encantada
Lines: 33
In-Reply-To: ljo@murphy.eeap.cwru.edu's message of 29 Dec 1992 20:31:26 GMT
Nntp-Posting-Host: lk-hp-9.hut.fi

On 29 Dec 1992 20:31:26 GMT, ljo@murphy.eeap.cwru.edu (L. Jonas Olsson) said:

Olsson> (If you're short of RAM and/or swap space you can try to
Olsson> replace your malloc routines in libc.a with the gnu malloc
Olsson> routines. On my system this results in gcc and several other
Olsson> large programs using only half as much data-space. For example
Olsson> with gcc -dm aprog.c you can see how much data gcc is using. I
Olsson> don't know why the data size is decreased and if the new
Olsson> malloc routines will break some other programs)

No kidding on the space savings! I grabbed a copy of GNU malloc from
the glibc-1.05 distribution and popped it into libc.a. Here are some
results of gcc 2.3.3 -dm (Data size used) for a few (gcc) example files:

Compiler	file		dist malloc	GNU malloc	new compared
								to old
--------	----		-----------	----------	------------
gcc 		expr.c		2580440		 872412		33.8%
		calls.c		1671128		 696284		41.7%
		c-parse.c	2056152		1056732		51.4%

gcc -O		expr.c		2973656		 909276		30.5%
		calls.c		1777624		 692188		38.9%
		c-parse.c	2269144		1028060		45.3%

Thanks for the tip, ljo! Now I can compile programs that used to bring
my machine to its knees with swapping (I only have 4MB RAM).

Of course, I have no idea of the other implications of using GNU
malloc. Is it slower/buggier/somehtinga than the dist malloc? Anyone
know of a good reason *not* to use it?

//Petri