Просмотр исходного кода

clear utf16 cache

this stops the unicode global cache from showing in the memleak output
marauder2k7 8 месяцев назад
Родитель
Сommit
d8315267e8

+ 5 - 0
Engine/source/core/strings/unicode.cpp

@@ -289,6 +289,11 @@ UTF8*  createUTF8string( const UTF16* unistring)
    return ret;
 }
 
+void UTF16ClearCache()
+{
+   sgUTF16Cache.clear();
+}
+
 //-----------------------------------------------------------------------------
 
 //-----------------------------------------------------------------------------

+ 3 - 1
Engine/source/core/strings/unicode.h

@@ -66,6 +66,8 @@ UTF16* createUTF16string( const UTF8 *unistring);
 
 UTF8*  createUTF8string( const UTF16 *unistring);
 
+void UTF16ClearCache();
+
 //-----------------------------------------------------------------------------
 /// Functions that convert buffers of unicode code points, into a provided buffer.
 /// - These functions are useful for working on existing buffers.
@@ -138,4 +140,4 @@ const UTF8* getNthCodepoint(const UTF8 *unistring, const U32 n);
 bool chompUTF8BOM( const char *inString, char **outStringPtr );
 bool isValidUTF8BOM( U8 bom[4] );
 
-#endif // _UNICODE_H_
+#endif // _UNICODE_H_

+ 2 - 1
Engine/source/main/main.cpp

@@ -231,7 +231,7 @@ S32 TorqueMain(S32 argc, const char **argv)
    //      argv = argvFake;
    //   }
 
-#if !defined(TORQUE_DISABLE_MEMORY_MANAGER)
+#if defined( TORQUE_DEBUG ) && !defined(TORQUE_DISABLE_MEMORY_MANAGER)
    Memory::init();
 #endif
 
@@ -257,6 +257,7 @@ S32 TorqueMain(S32 argc, const char **argv)
       Platform::restartInstance();
 
 
+
 #if defined( TORQUE_DEBUG ) && !defined( TORQUE_DISABLE_MEMORY_MANAGER )
    Memory::shutdown();
 #endif

+ 2 - 0
Engine/source/platformWin32/winWindow.cpp

@@ -317,6 +317,8 @@ void Platform::shutdown()
    GFXDevice::destroy();
 
    WinConsole::destroy();
+
+   UTF16ClearCache();
 }
 
 extern bool LinkConsoleFunctions;