diff --git a/cocos/2d/CCFontAtlas.cpp b/cocos/2d/CCFontAtlas.cpp index 3e1448d98c..8593a0f666 100644 --- a/cocos/2d/CCFontAtlas.cpp +++ b/cocos/2d/CCFontAtlas.cpp @@ -251,7 +251,7 @@ void FontAtlas::findNewCharacters(const std::u16string& u16Text, std::unordered_ else { auto length = u16Text.length(); - newChars.resize(length); + newChars.reserve(length); for (size_t i = 0; i < length; ++i) { auto outIterator = _letterDefinitions.find(u16Text[i]);