Homework 7: Garbage Collection

How to Design Programs: An Introduction to Programming and Computing

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
WPI CS536 (F07) Homework 7 CS 536 Homework 7: Garbage Collection Due: November 8, both hardcopy in class and electronically via turnin (asgmt name hwk7 ) You have two options for this assignment: 1. Implement both , and . 2. Implement a generational garbage collector Both assignments carry the same weight, so choose based on which option you'll find more interesting/ challenging/educational/etc. Details about each option are after the following section on the GC API in DrScheme. Info Common to Both Options Write your garbage collectors in the GC Collector Scheme language level. This langauge defines an interface to a program's stack and heap that you will use to implement garbage collection. Your garbage collectors must implement the following functions: init-allocator :: -> void The mutator implicitly calls this function after initializing the heap and before calling any allocation routines. It is essentially a callback into the allocator indicating that the heap is ready. gc:cons :: first-addr rest-addr -> cons-addr returns the address of a new cons cell with the given field addresses; the field addresses are presumed to be already allocated gc:cons? :: addr -> boolean returns a boolean that indicates whether the given address refers to a cons cell gc:first :: cons-addr -> first-addr and gc:rest :: cons-addr -> rest-addr return the fields of a given cons gc:set-first! :: cons-addr first-addr -> void and gc:set-rest! :: cons-addr rest-addr -> void set the addresses of the first and last pointers of a cons cell gc:alloc-flat :: atomic -> number allocates space for a flat value and returns the
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This homework help was uploaded on 02/06/2008 for the course CS 536 taught by Professor Fisler during the Fall '07 term at WPI.

Page1 / 4

Homework 7: Garbage Collection - WPI CS536 (F07) Homework 7...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online