malloc() on pyramid is weird.

Romain Kang romain at salt.pyramid.com
Fri Jan 4 07:48:42 AEST 1991


| Hi: For some time now I've been chasing a bug in a rather large
| program of mine. Turns out on every other architecture but the
| Pyramid the process size of this program turns out to be half as
| it is on the Pyramid.

The default version of malloc() attempts to align "large" chunks of
memory for optimal hardware performance.  Recognizing situations like
yours, there is a special libmalloc.a in the att universe that attempts
different space/time tradeoffs.  (Both ucb and the att default malloc()
are variants of the Caltech powers-of-two fast allocator.  What was
the alternate malloc() you were using?)

Unfortunately for you, libmalloc.a is not currently supported in the
ucb universe.  If you need it, call Customer Support.  In the mean
time, the following makefile will build a ucb-usable version of
att libmalloc.a (and don't tell anyone you got it from me).

Re-running your Sun numbers, I get:

Results: chunksize 220 times 15000 minerror 4 maxerror 4 avg 4.000000
Results: chunksize 280 times 15000 minerror 4 maxerror 8 avg 4.029335
Results: chunksize 250 times 15000 minerror 6 maxerror 6 avg 6.000000
Results: chunksize 200 times 15000 minerror 4 maxerror 12 avg 4.799253
Results: chunksize 300 times 15000 minerror 4 maxerror 4 avg 4.000000
Results: chunksize 511 times 15000 minerror 5 maxerror 13 avg 5.031735
Results: chunksize 512 times 15000 minerror 4 maxerror 12 avg 4.031735
Results: chunksize 513 times 15000 minerror 7 maxerror 15 avg 7.126409

========================================================================
#
# Use att libmalloc.a in the ucb universe
#
M_OBJS	= malloc.r mem.r assert.o

libmalloc.a:	$(M_OBJS)
	ar r $@ $(M_OBJS)
	ranlib $@

malloc.r:
	att ld -r -o $@ -u _malloc -lmalloc

mem.r:
	att  ld -r -o $@ -u _memcpy -u _memset -lc

#
# Can't ld -u __assert, because it would pull in abort(),
# which pulls in att stdio, which is incompatible with ucb <stdio.h>
#
assert.o:	/.attlib/libc.a
	att ar x /.attlib/libc.a $@

mtest:	mtest.o libmalloc.a
	cc -o mtest mtest.o libmalloc.a

clean:
	rm -f $(M_OBJS) mtest mtest.o

clobber:
	rm -f $(M_OBJS) libmalloc.a
--
"Eggheads unite! You have nothing to lose but your yolks!"  -Adlai Stevenson



More information about the Comp.sys.pyramid mailing list