From: ahoward Date: 2003-09-18T15:53:15+09:00 Subject: Re: Testing for memory leaks On Thu, 18 Sep 2003, Berger, Daniel wrote: > This message is in MIME format. Since your mail reader does not understand > this format, some or all of this message may not be legible. > > ------_=_NextPart_001_01C37D64.007DE79E > Content-Type: text/plain > > Hi all, > > Being as I write a lot of extensions, I've discovered that it's best to > check for memory leaks. The way I'm doing this now is something like this: > > # pseudo code > while 1 > call some_method > if Linux or BSD > check /proc/Process.pid/fd count > elsif Solaris > check pfiles Process.pid count > elsif Win32 > start Task Manager and watch used file descriptors and memory for > Process.pid > end > sleep 1 > end > > # Ctrl-C to break out of loop only after at least 10 iterations > > Is there a better and/or more streamlined way to do this? Any chance of > adding assert_no_memory_leak to TestUnit, for example? not ruby specific, but check out dmalloc and electric fence. they are both free, easy to use, and work pretty well. -a ==================================== | Ara Howard | NOAA Forecast Systems Laboratory | Information and Technology Services | Data Systems Group | R/FST 325 Broadway | Boulder, CO 80305-3328 | Email: ara.t.howard@noaa.gov | Phone: 303-497-7238 | Fax: 303-497-7259 | ~ > ruby -e 'p(%.\x2d\x29..intern)' ====================================