-
67
pages
-
English
-
Documents
Description
The Boehm-Demers-Weiser Conservative Garbage CollectorHans-J. BoehmHP Labs' 2004 Hewlett-Packard Development Company, L.P.The information contained herein is subject to change without notice Outline• Introduction Interface Implementation basics & goals• Implementation details and issues Core collector Enhancements• Experiences and a few measurementsWhat is it?• A garbage collecting replacement for C s malloc(). Calls to free() are optional. Unreachable memory is automatically reclaimed, and made available to future malloc() calls.• A tracing (mark/sweep) garbage collector. It periodically determines which objects can be reached by following pointers. The rest can be reused for other purposes.• An easy way to add garbage collection to a runtime system. Easy to interface to. Interacts well with C/C++ code. Gcj (Java), Mono (C#, .NET), Bigloo (Scheme), MzScheme.• A leak detector for programs that call free(). Unreachable unfreed memory is a memory leak.Example: Lisp S-expressions#include "gc.h"typedef union se {struct cons * cp; int i;} sexpr;struct cons { union se head; union se tail; };#define car(s) (s).cp->head#define cdr(s) (s).cp->tail#define from_i(z) ({sexpr tmp; tmp.i=z; tmp;})#define to_i(s) (s).isexpr cons(sexpr a, sexpr b) { tmp = {GC_MALLOC(sizeof(struct cons))};car(tmp) = a; cdr(tmp) = b;return (tmp);};int main() {return to_i(car(cons(from_i(0),from_i(1))));}Where did it come from?• Began life (ca. ...
-
Publié par
-
Langue
English