[rucksack-devel] GC problems

Edi Weitz edi at agharta.de
Wed Aug 9 13:21:36 UTC 2006


On Tue, 08 Aug 2006 16:47:44 +0200, "Arthur Lemmens" <alemmens at xs4all.nl> wrote:

> Edi Weitz wrote:
>
>>   (defun check-gc (n)
>>     (with-rucksack (rucksack *test-suite* :if-exists :supersede)
>>       (with-transaction ()
>>         ;; after this, INNER can be reached directly from the root
>>         (let* ((inner (p-cons "Waldorf" "Statler"))
>>                (root (p-cons 42 inner)))
>>           (add-rucksack-root root rucksack)))
>>       (with-transaction ()
>>         (let* ((root (first (rucksack-roots rucksack)))
>>                (inner (p-cdr root))
>>                (array (p-make-array n)))
>>           ;; after this, INNER can't be reached from the root anymore
>>           (setf (p-cdr root) 43)
>>           ;; now let the GC do some work
>>           (dotimes (i n)
>>             (let ((string (format nil "~R" i)))
>>               (setf (p-aref array i) (p-cons string string))))
>>           ;; hook INNER back to the root again before we finish the
>>           ;; transaction
>>           (setf (p-car root) array
>>                 (p-cdr root) (p-cons 'bar (p-cons 'foo inner))))) ; [***]
>>       (with-transaction ()
>>         (let* ((root (first (rucksack-roots rucksack)))
>>                (inner (p-cdr (p-cdr (p-cdr root)))))
>>           ;; we expect the list ("Waldorf" "Statler") here
>>           (list (p-car inner) (p-cdr inner))))))
>
>
> [snip]
>
> Would you agree that this problem can also be solved by writing
> dirty objects to disk when the scanner sees them?  Or am I missing
> something?

I'm not sure.  When you're in the DOTIMES loop above (which is
supposed to take a /long/ time), the only reference to INNER is from
an object which is in RAM.  Whatever you write to disk, you won't be
able to reach INNER unless you have left the loop.  But at that point
it'll probably be too late.



More information about the rucksack-devel mailing list