Garbage collection
David Gould
dg@REDACTED
Fri Aug 27 17:59:32 CEST 1999
On Fri, Aug 27, 1999 at 02:01:47AM +0000, Vlad Dumitrescu wrote:
> Hi!
>
> I will try to look closer at the existing collector... it is an interesting
> area. Difficult, but worth trying, I think. Only I have the time! :-)
>
> >Allocating a cons is done as:
> >
> >uint32 *mem = p->htop;
> >p->htop += 2;
And also:
if (p->htop >= p->maxhtop)
gc(p);
Or however it gets coded.
> >This is fast,
>
> The allocation is fast, but the collection will be slower!
>
> > if the Boehm collector should be used, we
> >need to replace this with:
> >
> >uint32 *mem = (uint32*) malloc(2);
> >
> >which is slow, extremely slow.
Uh no. The Boehm collector allocation is quite fast. Allocation gets inlined
as approximately:
if (freelist[size]) {
/* fast path allocation */
mem = freelist[size];
freelist[size] = *mem;
} else
/* possibly need to gc */
gen_malloc(size);
Which is not that slow.
-dg
--
David Gould dg@REDACTED 510.628.3783 or 510.305.9468
Informix Software 300 Lakeside Drive Oakland, CA 94612
You will cooperate with Microsoft, for the good of Microsoft
and for your own survival. -- Navindra Umanee
More information about the erlang-questions
mailing list