This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

destroy and garbage collection


Hi Per,

Can you explain how objects in kawa are destroyed or set as
unreferenced and waiting for garbage collection?

In my code I am using objects extensively in the form of lambda
objects with some local data

Example:

(define (my-object)
 (let ((data1 'some-data)
         (data2 'some-data2))

   (lambda (message)
      (cond ((equal? message 'set-data1)
                 (lambda (self new-value)
                      (set! data1 new-value)))))

Something like the above. We've got a procedure that will interact
with the lambda object inside and retrieve the correct procedure based
on what message is passed in and applying that procedure to a some
arguments.

This works in general but what I haven't figure out is how to destroy
objects in kawa. We would typically have many such objects store in a
scheme list or a hashtable and we've been doing (set! mylist '()) or
empty the hashtable.

Does that ensure the deletion of such objects that were previously
inside the list?
We have our own thread object that is created using a loop, a sleep
and future to create a periodically firing thread that execute a
procedure. We've put threads inside our objects and it seems with, the
thread still firing and running, the objects that have been emptied
from the list are still alive. If I stop the thread there wouldn't be
any way of knowing whether my objects are alive or not.

Can you walk me through the scheme way of destroying objects?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]