[racket] Memory and delimited continuations

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sat Oct 29 10:07:57 EDT 2011

Thanks for the example! I agree that there's a bug here, and I'm still
investigating.

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.



Posted on the users mailing list.