[racket] Memory and delimited continuations
I've pushed a repair.
Your earlier suspicion of a space-safety problem was correct, but the
needlessly retained reference was in the core implementation of
applying a composable continuation. (Perhaps ironically, the
incorrectly held reference was to a meta-continuation as part of the
code that implements the tail-call analogue of meta-continuations.)
At Thu, 27 Oct 2011 19:57:57 +0100, "nicolas.oury at gmail.com" wrote:
> Dear all,
>
> Following on my memory leak problem, I managed to minimise my program.
> And I still don't understand why it leaks.
>
> Here is a minimised example:
>
> (define prompt1 (make-continuation-prompt-tag 'p1))
> (define prompt2 (make-continuation-prompt-tag 'p2))
>
> (define (capture-and-abort prompt-tag)
> (call-with-composable-continuation
> (lambda (k) (abort-current-continuation prompt-tag k))
> prompt-tag))
>
> (define (test i)
> (call-with-continuation-prompt
> (lambda ()
> (call-with-continuation-prompt
> (lambda()
> (for ((j i))
> (capture-and-abort prompt1)
> (capture-and-abort prompt2)))
> prompt2))
> prompt1))
>
> (test 100000)
>
> Calling test with any number 100 000 or higher will allocate memory very
> fast.
> What is the reason for that and how can I solve this?
>
> Best regards,
>
> Nicolas.
> _________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users