From: Kent Dahl Date: 2002-05-25T06:56:42+09:00 Subject: Re: FAQ for newcomers familiar with lower level language Kyle Rawlins wrote: > In short, though memory management is made very easy in Ruby and other GC'd > languages, it worries me greatly that it could be considered good programming > practice to write anything beyond a simple script without thinking about issues > of resource usage. I concur. I haven't noticed any memory usage profilers for Ruby and I think this is a weakness. I scrapped my plans of writing a simple personal accounting tool in Ruby with FLTK for my PDA because the style of programming I had gotten used to with Ruby, turned out to chew up too much memory for the poor little thing. Are there existing/planned hooks into the GC? I know I'd like to be able to get some feedback from the GC about what the peaks are, how much it has freed since some point etc. Basically like those thermometers that measure daily bottom and daily top, plus status I could diff at (arbitrary) points in my code. GC.reset_max_mem_usage # create insanely many objects puts GC.max_mem_usage #=> writes the maximum memory usage # that has occured since reset_max_mem_usage prestatus = GC.mem_status # do create (and release) insanely many objects poststatus = GC.mem_status diff = poststatus - prestatus puts diff.total_allocated #=> total number of allocated bytes in period puts diff.total_released #=> total number of bytes free'd during GC in the period I'm just thinking out loud in code here, and seriously braindamaged by the way I used to write (naive) speed tests myself in other languages. If nothing else, I would like to see a requireable .so module that could allow this kind of thing for debugging. (No, I'm not writing one. gc.c was very scary last time I looked inside it. :-) -- (\[ Kent Dahl ]/)_ _~_ __[ http://www.stud.ntnu.no/~kentda/ ]___/~ ))\_student_/(( \__d L b__/ NTNU - graduate engineering - 4. year ) ( \__\_�|�_/__/ ) _)Industrial economics and technological management( \____/_�_\____/ (____engineering.discipline_=_Computer::Technology___)