[plt-scheme] Leak-chasing tricks?

From: Matt Jadud (mcj4 at kent.ac.uk)
Date: Mon Jul 31 09:28:58 EDT 2006

Here's my question-of-the-day:

We're updating the oh-so-popular XML-RPC library. I have the server 
running as a servlet, and observe (on the server-side) unbounded memory 
growth both under the conservative and 3m collectors. There appears to 
be no leakage on the client-side.

For example, if I make 1000 calls to a remote procedure (I'm remotely 
calling "(add 3 5)"), I go from 13/42 MB (real/virtual) usage to 
143/183. This goes up with each successive block of 1000 remote calls. 
Collecting garbage in the server's web interface does nothing; 
collecting garbage upon receipt of every call reduces the rate at which 
the server leaks, but does not stop it.

What I don't know how to do is go about locating the source of this 
leak. I've read through our code line-by-line more than once, and have 
made sure TCP/IP ports are closed, etc., but clearly there is something, 
somewhere, that isn't getting cleaned up. (I could easily be missing 
something critical simply by not looking for it.)

More worrying to me is that the leak isn't in my code, and in a library 
underneath me. That is something I would never find in my own source, no 
matter how hard I look... but for the moment, I'll distrust my code over 
that of others.

Is there a "smart" way to track this kind of thing down?

Many thanks,

Posted on the users mailing list.