From: John Carter Date: 2005-04-27T12:05:28+09:00 Subject: [ANN] ] MemoryProfile A memory usage profiling module. (was memory leak) On Wed, 27 Apr 2005, Joe Van Dyk wrote: > Got a memory leak in the following code.. not sure if DRb is necessary > in it or not. Try http://rubyforge.org/snippet/detail.php?type=snippet&id=70 It is really _very_ trivial to use. (it is also pretty brute force and dumb code) Save to snippet as MemoryProfile.rb and then run your code as ruby -w -r MemoryProfile your_code.rb On exit it reports simple counts and also traverses the object tree to give detailed counts of what object is using what and prints the largest object as well. The log file is appended to /tmp/memory_profile.log It takes quite a lot of time and memory... It also dumps /proc/pid/status to display your vm usage, so it is a little Linux specific, but you can cure that with a # or two. John Carter Phone : (64)(3) 358 6639 Tait Electronics Fax : (64)(3) 359 4632 PO Box 1645 Christchurch Email : john.carter@tait.co.nz New Zealand Refactorers do it a little better every time.