Re: The joy of garbage collection
- From: Pascal Bourguignon <spam@xxxxxxxxxxxxxxxx>
- Date: Thu, 29 Sep 2005 21:36:13 +0200
"robbie.carlton@xxxxxxxxx" <robbie.carlton@xxxxxxxxx> writes:
> Thanks for the replies folks, there's definitely some things I can use
> in there. I'm implementing it in c, which I should have made clearer,
> so I can't rely on the native environment for garbage collection. And
> yes, one of the objectives is to get an understanding of garbage
> collection
>
>
> The gc papers look good, I've been looking for something like that, but
> there's a lot of extremely technical papers out there that assume much
> prior knowledge. It's good to have a place to start.
>
> Also, the free list is the part I was missing, and the various ideas
> for implementing that are interesting. I especially like the bitmap
> idea.
>
> "I don't see how they could be on the heap
> individually and unboxed, where would the mark bit go, how
> could sweep know to leave them?"
>
> Yes! This is what I still don't understand. Where do you put the
> unboxed data, as it can't go on the heap. I think I could now implement
> a very simple garbage collector if everything was boxed, but I'd like
> strings, arrays and various c data structures as unboxed data. Does
> this make sense?
The bitmap, or separate typecode, are not the fastest solutions. But
if you want to mix easily C with Lisp, they might be worthwhile.
A somewhat intermediate solution between boxed and separate typecode,
is to assign type to each page. You can have pages of int32, pages of
char, pages of float, etc. But for random C structures, you can only
use separate typecodes, and this means that you have to duplicate
about all processing.
Otherwise, for C values, you can use/reimplement a conservative GC
like BoehmGC.
>From the lisp side, I would keep all values boxed. C values can come
from a C heap, or C static data or C stack. But all C values can be
refered to with a pointer. So you can have a boxed and typed pointer
to refer to C values from the Lisp side. Do you need to GC C values?
I guess not. If you mean to use existing C libraries, they do their
own memory management.
(make-c-pointer c-type c-address) --> c-locative
(type-of c-locative) --> 'C-LOCATIVE
(type-of-c-value c-locative) --> c-type
(c-value c-locative) --> lisp-value
(c-value c-locative) is a place.
So you wouldn't need to manage unboxed C values in your lisp heap.
--
"Our users will know fear and cower before our software! Ship it!
Ship it and let them flee like the dogs they are!"
.
- References:
- The joy of garbage collection
- From: robbie.carlton@xxxxxxxxx
- Re: The joy of garbage collection
- From: Ulrich Hobelmann
- Re: The joy of garbage collection
- From: robbie.carlton@xxxxxxxxx
- The joy of garbage collection
- Prev by Date: Re: The joy of garbage collection
- Next by Date: Re: Where to look for the API documentation?
- Previous by thread: Re: The joy of garbage collection
- Next by thread: Re: The joy of garbage collection
- Index(es):
Relevant Pages
|