[plt-scheme] web-server memory use

From: Dave Gurnell (d.j.gurnell at gmail.com)
Date: Mon Apr 30 09:36:14 EDT 2007

Hi again,

We've been getting some fast-expiring continuations using the web- 
server recently. I'm worried it might be a memory consumption thing,  
so I'm trying to find out how much memory instances and continuations  
are taking up.

I tried copying and customising lru.ss to do the following:

   - I added a custodian field to the instance structure:

     (define-struct instance (data k-table use-count custodian))

   - I modified create-instance to store a reference to the current  
     (which, looking at dispatch-servlets.ss, ought to be the  
instance's custodian):

     (hash-table-put! instances
                      (make-instance data (create-k-table) 0 (current- 

   - I printed the custodian's memory use in instance-lookup:

     (printf "Memory use: ~a~n" (current-memory-use (instance- 
custodian instance)))

This prints 0 each time. I checked the documentation and it doesn't  
look like this is an effect of memory accounting being switched off  
(although I'm not sure how I'd check that anyway).

Am I heading down the right track here? Are programmer-created data  
structures allocated under the instance custodian or the servlet  


-- Dave

Posted on the users mailing list.