From: John Carter Date: 2005-07-20T11:16:46+09:00 Subject: Re: Memory profiling? On Tue, 19 Jul 2005, Scott Ellsworth wrote: > Hi, all. > > I note that there is a fine package for time profiling, but I did not > see one for memory profiling. > > Did I miss one? There is... http://rubyforge.org/snippet/detail.php?type=snippet&id=70 > NB - if you have not looked in the Java profiler space lately, it might > be worth a glance. Virtually every profiler package out there can tell > you how many of each object are live, how many are dead, the line that > produced each allocation, and the amount of VM taken by each. Thus, you > can easily find: > The lines that allocated the most memory > The lines that churned (allocated and freed) the most memory > The lines that allocated the most objects > The lines that churned the most objects > The objects holding on to the most data My memory profiler is a bit orthogonal to that. It counts objects still active by class and the size of them. ie. It doesn't tell you which line it occurred on. The flip side is you have to work backwards to work out the guilty line. Usually (but not always) that's fairly easy. If BigHairyObjects are gobbling your memory, just grep for "BigHairyObject.new" It's not a very good profiler for counting churn. On the other hand, it is really very very easy to use. 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 Carter's Clarification of Murphy's Law. "Things only ever go right so that they may go more spectacularly wrong later." From this principle, all of life and physics may be deduced.