First page Back Continue Last page Overview Text


Every time it needs to expand the length of the string buffer, it creates a new ruby string that is twice as long, copying the data from the current string, and switches the string pointer over to the new ruby string's buffer.

The final ruby string created will be returned to the caller of the method. All other temporary ruby strings will be garbage collected the next time the ruby garbage collector runs.