I am sure I'm doing something silly here, but this won't call the finalizer
until the thread is done (or at least it correlates strongly...).
Currently x86_64 1.1.12:
(defclass finalize-test () ())
(defun make-my-thread ()
(bt:make-thread (lambda () (sleep 300))))
(defmethod initialize-instance ((instance finalize-test) &key
(format t "I am all done.~%"))))
(cl-user::gc :full t)
Calling GC repeatedly doesn't seem to do anything until I kill the thread
or wait for it to end.
Ryan Pavlik <rpavlik@...> | https://github.com/rpav
Ryan Pavlik <rpavlik@...> writes:
> I am sure I'm doing something silly here, but this won't call the finalizer
> until the thread is done (or at least it correlates strongly...).
> Currently x86_64 1.1.12:
There are two possible causes:
* Something that looks like a pointer is present on the stack
* Something is pinned down to be passed to C
Both of those situations will tell the GC not to move that pointer, in
the first case, to avoid falsely collecting a live object, and in the
second case, to allow C to work with an object without worrying that it
has moved. And the first case is what makes the GC conservative.
What is unfortunate is that this mechanism is page-granular, i.e., to
pin down a pointer, the whole page where it resides is pinned down. And
if the pages includes some other data, it won't be collected either.
With best regards, Stas.