This is commonly known as Small String / Small Buffer Optimization. This is how most implementations of C++'s std::string work also.