Re: Multiple Values and GC

[email protected] Wed, 15 Sep 2021 13:20:57 +0200
Newsgroups gmane.lisp.scheme.bigloo
Message-ID <[email protected]>
Hi Joseph,

>  Hello, Manuel, 
> 
> Have you had a chance to look into my observations about multiple value support in Bigloo (below)? I would appreciate a fix being included in the next version of Bigloo. 
> 
> Thank You,Joseph Donaldson
> 
>     On Wednesday, May 19, 2021, 09:22:56 AM PDT, Joseph Donaldson <[email protected]> wrote:  
>  
>  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?
This is a very good observation. There is indeed a potential memory leak
here. I guess that a simple way to mitigate the problem (if not to
eliminate it completely) is that %get-mvalues-val resets the
multiple-value slot it returns.

-- 
Manuel
signature.asc (application/pgp-signature, 487 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEELgdDMTtUx/Mxl41xMMxQ5DtOwukFAmFB2DkACgkQMMxQ5DtO
wulCIwgAzneHPKCJ8v7YML2yoeBYWkeyvqN/Y5WZTb9mJTtfQ+FT0PJRV+rxGQZW
i2BfWblFOnInfI6k1mwZ3IoYD3VWbxTRWqHZiSBpT9O/SjDAm7HBN4S0sE1PtTrj
IdO3Tw2pXNGyDEw3bRo2YXFr2DtL5QEze69xqBYiCua8VFH+MhsNHN1es8u62V7Z
2K4feRT2ibgGciDE2xDtkfTiYzYeBhE4mDnoL3AFx2D3jj9ZenD9eBUhMarWuh88
Rm63lrghTaAw2pOvxwP9hvaowNjBB5t5tcg2sgAylQP+KUSvdM0Xs5q+ZwgPVYBd
f/bkywLt1GE7h6X5V7yeyqL1hY9CSA==
=Wqrz
-----END PGP SIGNATURE-----