|
|
|
|
|
by alecdbrooks
4566 days ago
|
|
That's what it is doing. The additional RString structure associates the label "str2" with the characters (on the heap) allocated for the original string. Ruby experts can correct me if I'm wrong, but when Ruby sees a name like "str2" it looks it up in a table, which points it to the RString structure. From there, it can follow the pointer to the actual array of characters, which in this case is only stored once. |
|