Bob Rogers wrote:
Worse, the closed-over frame is leaked entirely. (Is this what the "obviously leaks memory" comment in src/register.c is talking about, or are there other cases of leakage?) But I think I have a handle on what's causing this, and hope to propose a fix shortly.
Yep re comment. It's probably just a matter of setting the initial ctx->ref_count to 1. A context is either de-allocated immediately, if the sub returns via RetContinuation (re_use := 1 in src/register.c:500) or when the (ret)continuation is destroyed. The latter case needs a proper ref_count setting. I'm pretty sure that frames left via exception are also leaking currently, which would also be covered by above strategy.
leo