环境:
cocos2d-x-3.0
cocostudio 1.5
vs2013
vld 2.4rc2
背景
使用cocostudio编辑UI,在代码中使用其导出的json
问题
在程序退出时,发现vld提示有内存泄露问题,大约泄露1MB多的内存,以下是部分信息
---------- Block 145 at 0x0045F920: 32 bytes ----------
Leak Hash: 0x6E5619AC, Count: 1, Total 32 bytes
Call Stack (TID 9692):
0x533EC260 (File and line number not available): MSVCR120D.dll!operator new
d:\program files (x86)\microsoft visual studio 12.0\vc\include\xmemory0 (848): SanGuo.exe!std::_Wrap_alloc<std::allocator >::allocate
d:\program files (x86)\microsoft visual studio 12.0\vc\include\xstring (2215): SanGuo.exe!std::basic_string<char,std::char_traits,std::allocator >::_Copy + 0x27 bytes
d:\program files (x86)\microsoft visual studio 12.0\vc\include\xstring (2246): SanGuo.exe!std::basic_string<char,std::char_traits,std::allocator >::_Grow + 0x13 bytes
d:\program files (x86)\microsoft visual studio 12.0\vc\include\xstring (1138): SanGuo.exe!std::basic_string<char,std::char_traits,std::allocator >::assign + 0xE bytes
d:\program files (x86)\microsoft visual studio 12.0\vc\include\xstring (727): SanGuo.exe!std::basic_string<char,std::char_traits,std::allocator >::basic_string<char,std::char_traits,std::allocator >
d:\program files (x86)\microsoft visual studio 12.0\vc\include\utility (93): SanGuo.exe!std::pair<std::basic_string<char,std::char_traits,std::allocator >,cocostudio::ObjectFactory::TInfo>::pair<std::basic_string<char,std::char_traits,std::allocator >,cocostudio::ObjectFactory::TInfo> + 0x39 bytes
d:\program files (x86)\microsoft visual studio 12.0\vc\include\utility (271): SanGuo.exe!std::make_pair<std::basic_string<char,std::char_traits,std::allocator > const &,cocostudio::ObjectFactory::TInfo const &> + 0x22 bytes
e:\cocos2dx_space\sanguo\cocos2d\cocos\editor-support\cocostudio\objectfactory.cpp (199): SanGuo.exe!cocostudio::ObjectFactory::registerType + 0x11 bytes
e:\cocos2dx_space\sanguo\cocos2d\cocos\editor-support\cocostudio\objectfactory.cpp (44): SanGuo.exe!cocostudio::ObjectFactory::TInfo::TInfo
e:\cocos2dx_space\sanguo\cocos2d\cocos\editor-support\cocostudio\widgetreader\textbmfontreader\textbmfontreader.cpp (13): SanGuo.exe!`dynamic initializer for ‘cocostudio::TextBMFontReader::Type’’ + 0x6C bytes
0x5331EBBA (File and line number not available): MSVCR120D.dll!initterm + 0x1A bytes
f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c (550): SanGuo.exe!__tmainCRTStartup + 0xF bytes
f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c (466): SanGuo.exe!wWinMainCRTStartup
0x76A4336A (File and line number not available): kernel32.dll!BaseThreadInitThunk + 0x12 bytes
0x77689F72 (File and line number not available): ntdll.dll!RtlInitializeExceptionChain + 0x63 bytes
0x77689F45 (File and line number not available): ntdll.dll!RtlInitializeExceptionChain + 0x36 bytes
Data:
54 65 78 74 42 4D 46 6F 6E 74 52 65 61 64 65 72 TextBMFo ntReader
00 CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD … …
---------- Block 83 at 0x0046DC40: 44 bytes ----------
Leak Hash: 0xF9B985C9, Count: 1, Total 44 bytes
Call Stack (TID 9692):
0x533EC260 (File and line number not available): MSVCR120D.dll!operator new
e:\cocos2dx_space\sanguo\cocos2d\cocos\editor-support\cocostudio\objectfactory.cpp (82): SanGuo.exe!cocostudio::ObjectFactory::getInstance + 0x7 bytes
e:\cocos2dx_space\sanguo\cocos2d\cocos\editor-support\cocostudio\objectfactory.cpp (43): SanGuo.exe!cocostudio::ObjectFactory::TInfo::TInfo + 0x9 bytes
e:\cocos2dx_space\sanguo\cocos2d\cocos\editor-support\cocostudio\widgetreader\buttonreader\buttonreader.cpp (13): SanGuo.exe!`dynamic initializer for ‘cocostudio::ButtonReader::Type’’ + 0x6C bytes
0x5331EBBA (File and line number not available): MSVCR120D.dll!initterm + 0x1A bytes
f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c (550): SanGuo.exe!__tmainCRTStartup + 0xF bytes
f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c (466): SanGuo.exe!wWinMainCRTStartup
0x76A4336A (File and line number not available): kernel32.dll!BaseThreadInitThunk + 0x12 bytes
0x77689F72 (File and line number not available): ntdll.dll!RtlInitializeExceptionChain + 0x63 bytes
0x77689F45 (File and line number not available): ntdll.dll!RtlInitializeExceptionChain + 0x36 bytes
Data:
8C B4 7D 01 28 DD 46 00 A8 DC 46 00 1B 00 00 00 …}.(.F. …F…
70 DD 46 00 F8 03 47 00 F8 05 47 00 F8 05 47 00 p.F…G. …G…G.
3F 00 00 00 40 00 00 00 00 00 80 3F ?..@… …?..
从这情形看好像是textbmfontreader.cpp和buttonreader.cpp两个文件是引起的,求解