Creates a new reference counted string and copies the contents of str into it.
str
a NUL-terminated string
the newly created reference counted string