emina / rosette

The Rosette solver-aided host language, sample solver-aided DSLs, and demos
Other
638 stars 74 forks source link

Fix unintentional value retain #248

Closed sorawee closed 1 year ago

sorawee commented 1 year ago

To quote to the documentation of parameters (https://docs.racket-lang.org/reference/parameters.html),

as far as the memory manager is concerned, the value originally associated with a parameter through parameterize remains reachable as long the continuation is reachable, even if the parameter is mutated.

The parameter current-terms is initialized and/or parameterized to a strong hash, making it not possible to GC the hash. This PR fixes the issue by initializing and/or parameterizing to #f first, and then mutates the parameter to a desired value later.

Fixes #247

sorawee commented 1 year ago

By the way, thanks to @rocketnia who pointed me to the parameter caveat!

rocketnia commented 1 year ago

Glad it worked out! 😄

emina commented 1 year ago

Great catch; thanks!