Source
(defmethod sweep-some-object-blocks ((heap mark-and-sweep-heap)
(amount integer))
;; Deallocate some dead object blocks.
(let* ((object-table (object-table heap))
(object-block-size (min-block-size object-table))
(current-id (floor (nr-object-bytes-sweeped heap)
object-block-size))
(work-done 0))
(loop for object-id from current-id
while (and (< work-done amount)
(< object-id (object-table-size object-table)))
do (progn
;; Hook dead object blocks back into the free list.
(when (eql (object-info object-table object-id) :dead-object)
(delete-object-id object-table object-id)
;; Don't forget to remove the id->object mapping from
;; the cache! (This was a difficult bug to find.)
(cache-delete-object object-id (rucksack-cache (rucksack heap))))
(incf (nr-object-bytes-sweeped heap) object-block-size)))
;;
(when (>= (nr-object-bytes-sweeped heap) (nr-object-bytes heap))
;; We've finished sweeping the object table: move to the next state.
(setf (state heap) :finishing))
;; Return the amount of work done.
work-done))
Source Context