The JRuby implementation of StringIO allocates a separate StringIOData "ptr" object to hold the actual contents of the StringIO. This was only done because the C version does something similar, due to the inability of CRuby to store this state in the actual heap object. Since JRuby has no such limitation (the JVM supports variable-width objects), this extra object just adds overhead to the JRuby StringIO extension.
Eliminate the extra object and reference and move those fields into the StringIO object.