Reference eligibility for garbage collection across a function call
This may be Win32 specific: I am wondering if there is a strict definition or understanding around of what makes data eligible for garbage collection. Clearly (as one of my examples shows), LW can make an item eligible the last time it can possibly be accessed, not necessarily keeping it around in "scope". In my example, I pass a huge list from test2 to test, and in the defun example does the list gets cleared mid-function in the clean-down. However, in the defmethod example, the outer test2 function call (or something else) seems to keep the parameter eligible for garbage collection What makes the defmethod work differently, and is this phenomenon documented anywhere? Thanks, Matt To repeat the phenomenon: Open up process browser, and make sure mem usage AND VM Size are showing for the lispworks IDE. Note the ram usage beforehand. (declaim (optimize (safety 0) (speed 3) (debug 0))) (defmacro do-compiled (&rest rest) `(funcall (compile nil (lambda () ,@rest)))) ; Example 1 (do-compiled (defun test (list) (print "Press ENTER to CLEAN-DOWN") (read-line) (hcl:clean-down) (print "Extra memory should be cleared - Press ENTER to EXIT") (read-line)) (defun test2 () (hcl:clean-down) (test (make-list 10000000))) ) (test2) ; Example 2 (do-compiled (defmethod test (list) (print "Press ENTER to CLEAN-DOWN") (read-line) (hcl:clean-down) (print "10000000 element list should still be hogging ram - Press ENTER to EXIT") (read-line)) (defmethod test2 () (hcl:clean-down) (test (make-list 10000000))) ) (test2)