[plt-scheme] web-server memory use

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Apr 30 10:33:01 EDT 2007

At Mon, 30 Apr 2007 10:02:32 -0400, "Jay McCarthy" wrote:
> There is a bit of a problem, because the continuation manager is
> reachable by the servlet custodian, and it touches all your
> continuations, which touches all your instance data.

Is there a particular custodian that should be charged for each
continuation? (The instance's continuation?)

If so, I think you could use the following `make-cust-box' to insert a
indirection from the continuation manager to each continuation:

 (define (make-cust-box cust v)
   (let ([ch (make-channel)])
     (parameterize ([current-custodian cust])
       (thread (lambda ()
                 (let loop ()
                   (channel-put ch v)

 (define (cust-box-val l)
   (channel-get l))

If it it turns out to be the right idea, a direct implementaton of in
MzScheme would be much cheaper (instead of requiring a whole thread and
a context switch per access); a direct implementation also would be
easy to add.


Posted on the users mailing list.