Re: class gc and gc_alloc(0, xxx)

Date view Thread view Subject view Author view

From: Archie Cobbs (archie@whistle.com)
Date: Fri Dec 18 1998 - 17:23:51 EST


Godmar Back writes:
> > > > - add an assert(size != 0) in gcMalloc().
> > >
> > > Yes, I think that's a good course of action.
> > > I also added an assert if someone attempt to free non-fixed objects.
> >
> > It's not clear to me why trying to allocate zero bytes is a bug.
> > Why not just return NULL in this case?
>
> That would fix the mark problem. However at some point, we will want
> to gracefully handle out of memory conditions. I propose we use NULL
> for that.

Oh yeah, forgot about that. Then instead we can use a special
magic value that the walker recognizes (and ignores).

FreeBSD's malloc/free does something akin to this.

-Archie

___________________________________________________________________________
Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 19:57:23 EDT