In article <1121754497.384756.15254.nullmailer / x31.priv.netlab.jp>,
 Yukihiro Matsumoto <matz / ruby-lang.org> wrote:

> Hi,
> 
> In message "Re: Memory profiling?"
>     on Tue, 19 Jul 2005 09:45:55 +0900, Scott Ellsworth <scott / alodar.com> 
>     writes:
> 
> |I note that there is a fine package for time profiling, but I did not 
> |see one for memory profiling.
> |
> |Did I miss one?
> 
> I'm afraid I haven't seen one.  It would be a nice idea to a memory
> profiler.  If someone is willing to create one and requires my help (I
> bet he needs to tweak the source), feel free contact me.

I suspect a good implementation would require source tweaking, because 
trying to second guess memory allocations and the like based on the 
executable image gets really, really hard.  Low impact memory profiling 
requires knowing what the GC system is doing, and having forensics for 
it.  For an example, check out 
<http://java.sun.com/j2se/1.5.0/docs/guide/jvmti/jvmti.html>
 for the rather baroque, but reasonably efficient, system current JVMs 
use for debugging tools.

We likely do not need quite this level of instrumentation, but we might 
want to hoover the spec for ideas.  If nothing else, we are not running 
a bytecode-only environment like Java, so we have both different needs 
and different tools.  For example, native C code, as best as I can tell, 
is very cheap in Ruby, often very expensive in Java.

(I say we.  I am still a Ruby tyro - hopefully, someone with both time 
and more experience than I have will find this interesting enough to do.)

Scott

-- 
Scott Ellsworth
scott / alodar.nospam.com
Java and database consulting for the life sciences