Multiple Values and GC

Joseph Donaldson <[email protected]> Wed, 19 May 2021 16:22:56 +0000 (UTC)
Newsgroups gmane.lisp.scheme.bigloo
Message-ID <[email protected]>
Hello, Manuel,
I recently wrote some code using Bigloo's support for multiple values and discovered that there is an issue with call-with-values that results in incorrect results for some nested invocations. For example, 

(call-with-values (lambda ()
                   (call-with-values (lambda () (values 1 2 3))
                                     +))
                   list)
currently returns (6 2 3) instead of (6). I submitted a small pull request that I believe corrects this, but after looking a bit more at the implementation of multiple values support in Bigloo, I suspect we have a potential memory leak if the only reference to a value is in one of the multiple-values slots that was previously used. Am I missing something that prevents this from happening? If not, should we set the slots to unspecified once the values are retrieve inĀ $get-mvalues-val?
Thank You,Joseph Donaldson