Subject: Re: libsa/alloc.c 'freelist' initialization
To: None <firstname.lastname@example.org>
From: Simon Burge <email@example.com>
Date: 05/11/1999 09:18:38
Chris G. Demetriou wrote:
> Any reason why 'freelist' in libsa/alloc.c is initialized to 0 rather
> than being zero a start by virtue of being in BSS?
> Standalone programs have to clear BSS anyway, I can't imagine them
> having to allocate memory before doing that, and there's no point in
> wasting 4 or 8 bytes in the data segment (which typically must fit
> into a fixed size).
Sounds like a good call to me. I don't suppose egcs is smart enough to
move variables initialised to 0 to the BSS?
FWIW, I'm sitting on an alloc that's basically:
static top = end;
old = top
top += size;
with no implementation of free(). I was using this then the first stage
pmax bootblocks didn't fit into 7.5k when we first changed from gcc to
egcs. There was less than half a dozen calls to alloc() totalling less
than 30kB. Another option is to #ifdef out the check to make sure that
the region can hold the freelist struct.
Since then of course there's about 1.5k free with all the whizzbang
libsa options turned on (ta Chris!).