This could be a big problem. Whenever an object defines a new instance variable, we store a name/offset mapping for that variable on the nearest concrete class. In the case of normal objects, this means that singletons can bloat up the number of instance variables on their related class, but in practice that does not happen much. Unfortunately on classes, this means that all classes in the system that set class instance variables are increasing the size of the variable table on the Class class, since that is the nearest concrete class.
system ~/projects/jruby $ jirb
>> class Foo
>> @foo = 1
>> require 'jruby'
>> cls_j = JRuby.reference(Class)
=> ["__size__", "__member__", "@local", "@RCS_ID", "@debug_level", "@foo", "@java_class", "@java_interfaces"]
In a large app with a lot of class instance variables, this could cause the size of those classes variable arrays to be much larger than they should be.
It's worth noting that the arrays are created lazily, so only classes that set instance vars will ever cause them to be created.
This came up during an IRC discussion about ActiveRecord 3+ scopes, which create singleton classes and set class instance variables extensively.
So I've verified that this is still the case with JRuby 22.214.171.124, is this really something to care about @headius? It hasn't been much of a problem in the past two years as far as I can tell :)