Sven C. Koehler wrote:
> Hello!
>
> Is there a way to get a list of all GC roots in my Ruby program?  I
> know there is a memory leak somewhere in my application, I just don't
> know in which part.  Listing all variables on the Heap becomes too
> large, but just seeing the GC roots would be a great help.  Can you
> suggest some ideas?

I don't think this info is available.  But how about statistics per class?
That way you can at least determine which class is responsible for the
massive object count.

17:09:39 [source]: ruby -r pp -e 'c=Hash.new(0); ObjectSpace.each_object
{|obj| c[obj.class]+=1}; pp c.sort_by {|k,v| -v}'
[[String, 582],
 [Class, 185],
 [Module, 18],
 [Array, 8],
 [Float, 6],
 [Regexp, 6],
 [Object, 3],
 [IO, 3],
 [File, 2],
 [NoMemoryError, 1],
 [SystemStackError, 1],
 [Binding, 1],
 [fatal, 1],
 [ThreadGroup, 1],
 [Hash, 1],
 [Thread, 1]]

Kind regards

    robert