Why don't you do SetLength(n, 16) (though it would be more correct to use SetLength(n, 31) as the man page for pthread_setname_np states that the maximum length is 31 Byte)? The function will even NUL-terminate the string for you, so it will have the right length after that...