JRuby master for your little script with ObjectSpace on:

~/projects/jruby jruby -X+O c.rb
   210 String
   152 Class
    16 Module
     5 Float
     4 Array
     3 Hash
     3 IO
     2 Object
     1 Binding
     1 Thread
     1 ThreadGroup

Note that even with it on we don't track a lot of transient objects in
ObjectSpace, so there's potentially others floating around not shown
here.

- Charlie

On Fri, May 21, 2010 at 4:51 AM, Robert Klemme
<shortcutter / googlemail.com> wrote:
> 11:47:36 Temp$ cat c.rb
> cnt = Hash.new 0
>
> ObjectSpace.each_object(Object) do |o|
> cnt[o.class] += 1
> end
>
> cnt.sort_by {|k,v| -v}.each do |cl,count|
> printf "%6d %s\n", count, cl
> end