retactoring get-allocated-string