glib dependency for the X Server

Carsten Haitzler (The Rasterman) raster at rasterman.com
Wed Apr 5 16:59:52 PDT 2006


On 05 Apr 2006 14:56:36 -0400 Greg Stark <gsstark at mit.edu> babbled:

> 
> Bernardo Innocenti <bernie at develer.com> writes:
> 
> > > you also miss the fact that initilising an empty list is
> > > more expensive and more work than simply starting with calloc()ed memory
> > > that's already NULL'ed out (so your lists start empty).
> > 
> > Initializing an empty list took just 3 m68k instructions, but I
> > agree with you that no initialization at all is even better.
> 
> I'm not sure why I'm dragging this thread out any longer when it's already
> gone on too long.
> 
> But where on earth did the idea that calloc was free come from?

it's not always free. in theory it should be free when its a fresh page from
the OS as the kernel will have zeroed it out for security reasons anyway (and
i'd hope libc is smart enough to know this - if it's not - then its the price
of a page re-use). secondly i calloc damn near everything myself because

1. structs of mine in a "safe known state" are all 0.
2. it has saved me from countless 100's of bugs by always having a known
starting state (my pointers are 0 - my values are 0 - everything in a known
state i always check for and skip/abort any more work on)

i DONT calloc "vast chunks" of ram (eg pixels or audio data etc. etc.) where if
they start off with garbage data - it doesn't matter.

-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    raster at rasterman.com
裸好多
Tokyo, Japan (東京 日本)



More information about the xorg mailing list