next up previous
Next: Rooted Trees Up: CSE 2320: Algorithms and Previous: Example

Pseudocode

   Free(x)
      next[x] = FreeList
      FreeList = x


   Allocate()
      if FreeList = NIL
      then error "out of memory"
      else x = FreeList
           FreeList = next[x]
           return x

Garbage Collection

Mark-and-Sweep

Mark all objects reachable through head(L), put rest (unmarked) on FreeList



Copyright © 1998 The University of Texas at Arlington