[rucksack-devel] A leak - need to understand how and when garbage collection influences the heap file

Matt Lamari matt.lamari at gmail.com
Sun Aug 23 07:04:13 UTC 2009


The code below lists the problem.  Essentially, I repeatedly overwrite
the slot ":payload" with a new string, inside a distinct transaction. 
Every overwrite grows the size of the file "heap", in perpetuity.

I understand that each change to the object creates a new version of it
- but what allows/causes the removal of the old ones?

What *should* I be doing here to stop the "heap" file from growing
indefinitely?  I assume this is a case of misuse on my part; but I'll
need to know why to better understand how Rucksack works.

Thanks,
Matt



(defparameter *rs-tute-directory* #p"c:/RSTest/")

(defmacro wrst (&rest body)
  `(with-rucksack (rs *rs-tute-directory*) (with-transaction () , at body)))

(wrst
 (defclass test-type ()
   ((name :initarg :name :accessor get-name :index
:case-insensitive-string-index)
    (payload :initarg :payload :accessor get-payload))
   (:index t)
   (:metaclass persistent-class)))

(defmethod print-object ((obj test-type) stream)
  (print-object (concatenate 'string "test-type: " (get-name obj) "  "
(format nil "~S" (get-payload obj))) stream))

(wrst
 (make-instance 'test-type :name "Fred" :payload "temp"))

; This replaces the :payload slot over and over again in a new
transaction, with a new string
(loop for i from 1 do (wrst (let ((obj (block nil (rucksack-map-class rs
'test-type (lambda (elt) (return elt)))))) (setf (get-payload obj)
(format nil "~R" (random 1000000000))))))






More information about the rucksack-devel mailing list