Macro: WITH-ALLOCATION-COUNTER

Source

(defmacro with-allocation-counter ((heap) &body body)
  (let ((heap-var (gensym "HEAP"))
        (old-counter (gensym "COUNTER")))
    `(let* ((,heap-var ,heap)
            (,old-counter (reset-allocation-counter ,heap-var)))
       (unwind-protect (progn ,@body)
         (setf (nr-allocated-octets ,heap-var) ,old-counter)))))
Source Context