(defpackage :gc-lisp (:use :common-lisp)) (in-package :gc-lisp) (defstruct (int (:constructor make-int (v))) v) (defmacro with-useless-objects ((&optional (count 35)) &body body) (loop for k below count for g = (gensym) collect `(,g (make-int 0)) into bindings collect g into ignores finally (return `(let ,bindings (declare (ignore ,@ignores)) ,@body)))) (defun create-objects (depth) (with-useless-objects (35) (when (< depth 2) (loop repeat 10 do (create-objects (1+ depth)))))) (defun run () (loop repeat 10000 do (create-objects 0)))