Memory leaks

I create hello world project by template,then i compile and run it without any modify.
Check it with vld, and fond many memory leaks, memory leaks report as follows:

WARNING: Visual Leak Detector detected memory leaks!
———- Block 799 at 0x01246468: 4 bytes ———-
Call Stack:
f:*bld\self_x86\crt\src\dbgmalloc.c : malloc
c:files\microsoft visual studio 10.0\vc\include\xmemory : std::*Allocate<cocos2d::CCScene *>
c:files\microsoft visual studio 10.0\vc\include\xmemory (187): std::allocator<cocos2d::CCScene *>::allocate
c:files\microsoft visual studio 10.0\vc\include\vector (751): std::vector<cocos2d::CCScene *,std::allocator<cocos2d::CCScene *> >::reserve
c:files\microsoft visual studio 10.0\vc\include\vector (1298): std::vector<cocos2d::CCScene *,std::allocator<cocos2d::CCScene *> >::*Reserve
c:files\microsoft visual studio 10.0\vc\include\vector : std::vector<cocos2d::CCScene *,std::allocator<cocos2d::CCScene *> >::push_back
d:2d-1.0.1-x-0.12.0\cocos2dx\include\ccmutablearray.h : cocos2d::CCMutableArray<cocos2d::CCScene *>::addObject
d:2d-1.0.1-x-0.12.0\cocos2dx\ccdirector.cpp : cocos2d::CCDirector::pushScene
d:2d-1.0.1-x-0.12.0\cocos2dx\ccdirector.cpp : cocos2d::CCDirector::runWithScene
d:world\hello world\classes\appdelegate.cpp : AppDelegate::applicationDidFinishLaunching
d:2d-1.0.1-x-0.12.0\cocos2dx\platform\win32\ccapplication_win32.cpp : cocos2d::CCApplication::run
d:world\hello world\win32\main.cpp : wWinMain
f:*bld\self_x86\crt\src\crtexe.c (547): *tmainCRTStartup
f:*bld\self_x86\crt\src\crtexe.c : wWinMainCRTStartup
0x7C817077 : RegisterWaitForInputIdle
Data:
F0 68 24 01 .h$…… ………
———- Block 798 at 0x06637188: 112 bytes ———-
Call Stack:
f:*bld\self_x86\crt\src\dbgmalloc.c : malloc
c:files\microsoft visual studio 10.0\vc\include\xmemory : std::*Allocate<cocos2d::CCObject *>
c:files\microsoft visual studio 10.0\vc\include\xmemory : std::allocator<cocos2d::CCObject *>::allocate
c:files\microsoft visual studio 10.0\vc\include\vector : std::vector<cocos2d::CCObject *,std::allocator<cocos2d::CCObject *> >::reserve
c:files\microsoft visual studio 10.0\vc\include\vector : std::vector<cocos2d::CCObject *,std::allocator<cocos2d::CCObject *> >::*Reserve
c:files\microsoft visual studio 10.0\vc\include\vector : std::vector<cocos2d::CCObject *,std::allocator<cocos2d::CCObject *> >::push_back
d:2d-1.0.1-x-0.12.0\cocos2dx\include\ccmutablearray.h : cocos2d::CCMutableArray<cocos2d::CCObject *>::addObject
d:2d-1.0.1-x-0.12.0\cocos2dx\cocoa\ccautoreleasepool.cpp : cocos2d::CCAutoreleasePool::addObject
d:2d-1.0.1-x-0.12.0\cocos2dx\cocoa\ccautoreleasepool.cpp : cocos2d::CCPoolManager::addObject
d:2d-1.0.1-x-0.12.0\cocos2dx\cocoa\ccobject.cpp : cocos2d::CCObject::autorelease
d:2d-1.0.1-x-0.12.0\cocos2dx\support\ccarray.cpp : cocos2d::CCArray::arrayWithCapacity
d:2d-1.0.1-x-0.12.0\cocos2dx\base_nodes\ccnode.cpp : cocos2d::CCNode::childrenAlloc
d:2d-1.0.1-x-0.12.0\cocos2dx\base_nodes\ccnode.cpp : cocos2d::CCNode::addChild
d:2d-1.0.1-x-0.12.0\cocos2dx\base_nodes\ccnode.cpp : cocos2d::CCNode::addChild
d:world\hello world\classes\helloworldscene.cpp : HelloWorld::scene
d:world\hello world\classes\appdelegate.cpp : AppDelegate::applicationDidFinishLaunching
d:2d-1.0.1-x-0.12.0\cocos2dx\platform\win32\ccapplication_win32.cpp : cocos2d::CCApplication::run
d:world\hello world\win32\main.cpp : wWinMain
f:*bld\self_x86\crt\src\crtexe.c :**tmainCRTStartup
f:*bld\self_x86\crt\src\crtexe.c : wWinMainCRTStartup
0x7C817077 : RegisterWaitForInputIdle
Data:
78 C5 24 01 F0 68 24 01 F0 70 24 01 98 74 24 01 x.$…h$. .p$…t$.
18 6D 24 01 E8 72 24 01 E8 1E 61 06 78 1B 61 06 .m$…r$. …a.x.a.
58 73 24 01 C0 6B 24 01 F8 71 24 01 60 CA 24 01 Xs$…k$. .q$.`.$.
C0 CB 24 01 68 CC 24 01 08 1E 61 06 D0 9E 63 06 …$.h.$. …a…c.
68 01 60 06 28 00 6A 06 70 6A 24 01 98 70 63 06 h.`.: malloc
c:files\microsoft visual studio 10.0\vc\include\xmemory : std::*Allocatestd::_Container_proxy
c:files\microsoft visual studio 10.0\vc\include\xmemory : std::allocatorstd::_Container_proxy::allocate
c:files\microsoft visual studio 10.0\vc\include\xstring : std::*String_val<char,std::allocator >::*String_val<char,std::allocator >
c:files\microsoft visual studio 10.0\vc\include\xstring : std::basic_string<char,std::char_traits,std::allocator >::basic_string<char,std::char_traits,std::allocator >
d:2d-1.0.1-x-0.12.0\cocos2dx\platform\win32\ccimage_win32.cpp : cocos2d::BitmapDC::BitmapDC
d:2d-1.0.1-x-0.12.0\cocos2dx\platform\win32\ccimage_win32.cpp : cocos2d::sharedBitmapDC
d:2d-1.0.1-x-0.12.0\cocos2dx\platform\win32\ccimage_win32.cpp : cocos2d::CCImage::initWithString
d:2d-1.0.1-x-0.12.0\cocos2dx\textures\cctexture2d.cpp : cocos2d::CCTexture2D::initWithString
d:2d-1.0.1-x-0.12.0\cocos2dx\textures\cctexture2d.cpp : cocos2d::CCTexture2D::initWithString
d:2d-1.0.1-x-0.12.0\cocos2dx\label_nodes\cclabelttf.cpp : cocos2d::CCLabelTTF::setString
d:2d-1.0.1-x-0.12.0\cocos2dx\label_nodes\cclabelttf.cpp : cocos2d::CCLabelTTF::initWithString
d:2d-1.0.1-x-0.12.0\cocos2dx\label_nodes\cclabelttf.cpp : cocos2d::CCLabelTTF::labelWithString
d:2d-1.0.1-x-0.12.0\cocos2dx\ccdirector.cpp : cocos2d::CCDirector::setGLDefaultValues
d:2d-1.0.1-x-0.12.0\cocos2dx\ccdirector.cpp : cocos2d::CCDirector::setOpenGLView
d:world\hello world\classes\appdelegate.cpp : AppDelegate::applicationDidFinishLaunching
d:2d-1.0.1-x-0.12.0\cocos2dx\platform\win32\ccapplication_win32.cpp : cocos2d::CCApplication::run
d:world\hello world\win32\main.cpp : wWinMain
f:*bld\self_x86\crt\src\crtexe.c :*tmainCRTStartup
f:*bld\self_x86\crt\src\crtexe.c : wWinMainCRTStartup
0x7C817077 : RegisterWaitForInputIdle
Data:
48 7A 38 10 00 00 00 00 Hz8…… ………
———- Block 206 at 0x0124C4E0: 4 bytes ———-
Call Stack:
f:*bld\self_x86\crt\src\dbgmalloc.c (56): malloc
c:files\microsoft visual studio 10.0\vc\include\xmemory (36): std::*Allocate<cocos2d::CCAutoreleasePool *>
c:files\microsoft visual studio 10.0\vc\include\xmemory : std::allocator<cocos2d::CCAutoreleasePool *>::allocate
c:files\microsoft visual studio 10.0\vc\include\vector : std::vector<cocos2d::CCAutoreleasePool *,std::allocator<cocos2d::CCAutoreleasePool *> >::reserve
c:files\microsoft visual studio 10.0\vc\include\vector : std::vector<cocos2d::CCAutoreleasePool *,std::allocator<cocos2d::CCAutoreleasePool *> >::*Reserve
c:files\microsoft visual studio 10.0\vc\include\vector (992): std::vector<cocos2d::CCAutoreleasePool *,std::allocator<cocos2d::CCAutoreleasePool *> >::push_back
d:2d-1.0.1-x-0.12.0\cocos2dx\include\ccmutablearray.h (117): cocos2d::CCMutableArray<cocos2d::CCAutoreleasePool *>::addObject
d:2d-1.0.1-x-0.12.0\cocos2dx\cocoa\ccautoreleasepool.cpp (135): cocos2d::CCPoolManager::push
d:2d-1.0.1-x-0.12.0\cocos2dx\ccdirector.cpp (127): cocos2d::CCDirector::init
d:2d-1.0.1-x-0.12.0\cocos2dx\ccdirector.cpp (76): cocos2d::CCDirector::sharedDirector
d:2d-1.0.1-x-0.12.0\cocos2dx\platform\win32\cceglview_win32.cpp (250): cocos2d::CCEGLView::Create
d:world\hello world\classes\appdelegate.cpp (30): AppDelegate::initInstance
d:2d-1.0.1-x-0.12.0\cocos2dx\platform\win32\ccapplication_win32.cpp (46): cocos2d::CCApplication::run
d:world\hello world\win32\main.cpp (16): wWinMain
f:*bld\self_x86\crt\src\crtexe.c :**tmainCRTStartup
f:*bld\self_x86\crt\src\crtexe.c (371): wWinMainCRTStartup
0x7C817077 (File and line number not available): RegisterWaitForInputIdle
Data:
D8 C3 24 01 …$…… ………

———- Block 205 at 0x0124C498: 8 bytes ———-
Call Stack:
f:*bld\self_x86\crt\src\dbgmalloc.c : malloc
c:files\microsoft visual studio 10.0\vc\include\xmemory : std::*Allocatestd::_Container_proxy
c:files\microsoft visual studio 10.0\vc\include\xmemory (187): std::allocatorstd::_Container_proxy::allocate
c:files\microsoft visual studio 10.0\vc\include\vector (442): std::*Vector_val<cocos2d::CCObject *,std::allocator<cocos2d::CCObject *> >::*Vector_val<cocos2d::CCObject *,std::allocator<cocos2d::CCObject *> >
c:files\microsoft visual studio 10.0\vc\include\vector (508): std::vector<cocos2d::CCObject *,std::allocator<cocos2d::CCObject *> >::vector<cocos2d::CCObject *,std::allocator<cocos2d::CCObject *> >
d:2d-1.0.1-x-0.12.0\cocos2dx\include\ccmutablearray.h (45): cocos2d::CCMutableArray<cocos2d::CCObject *>::CCMutableArray<cocos2d::CCObject *>
d:2d-1.0.1-x-0.12.0\cocos2dx\cocoa\ccautoreleasepool.cpp (34): cocos2d::CCAutoreleasePool::CCAutoreleasePool
d:2d-1.0.1-x-0.12.0\cocos2dx\cocoa\ccautoreleasepool.cpp (130): cocos2d::CCPoolManager::push
d:2d-1.0.1-x-0.12.0\cocos2dx\ccdirector.cpp (127): cocos2d::CCDirector::init
d:2d-1.0.1-x-0.12.0\cocos2dx\ccdirector.cpp (76): cocos2d::CCDirector::sharedDirector
d:2d-1.0.1-x-0.12.0\cocos2dx\platform\win32\cceglview_win32.cpp (250): cocos2d::CCEGLView::Create
d:world\hello world\classes\appdelegate.cpp (30): AppDelegate::initInstance
d:2d-1.0.1-x-0.12.0\cocos2dx\platform\win32\ccapplication_win32.cpp (46): cocos2d::CCApplication::run
d:world\hello world\win32\main.cpp (16): wWinMain
f:*bld\self_x86\crt\src\crtexe.c :**tmainCRTStartup
f:*bld\self_x86\crt\src\crtexe.c (371): wWinMainCRTStartup
0x7C817077 (File and line number not available): RegisterWaitForInputIdle
Data:
44 C4 24 01 00 00 00 00 D.$…… ………

———- Block 204 at 0x0124C430: 40 bytes ———-
Call Stack:
f:*bld\self_x86\crt\src\dbgmalloc.c : malloc
d:2d-1.0.1-x-0.12.0\cocos2dx\cocoa\ccautoreleasepool.cpp : cocos2d::CCAutoreleasePool::CCAutoreleasePool
d:2d-1.0.1-x-0.12.0\cocos2dx\cocoa\ccautoreleasepool.cpp : cocos2d::CCPoolManager::push
d:2d-1.0.1-x-0.12.0\cocos2dx\ccdirector.cpp : cocos2d::CCDirector::init
d:2d-1.0.1-x-0.12.0\cocos2dx\ccdirector.cpp : cocos2d::CCDirector::sharedDirector
d:2d-1.0.1-x-0.12.0\cocos2dx\platform\win32\cceglview_win32.cpp : cocos2d::CCEGLView::Create
d:world\hello world\classes\appdelegate.cpp : AppDelegate::initInstance
d:2d-1.0.1-x-0.12.0\cocos2dx\platform\win32\ccapplication_win32.cpp : cocos2d::CCApplication::run
d:world\hello world\win32\main.cpp : wWinMain
f:*bld\self_x86\crt\src\crtexe.c (547): *tmainCRTStartup
f:*bld\self_x86\crt\src\crtexe.c : wWinMainCRTStartup
0x7C817077 : RegisterWaitForInputIdle
Data:
74 48 30 10 07 00 00 00 00 00 00 00 01 00 00 00 tH0…… ………
00 CD CD CD 98 C4 24 01 88 71 63 06 88 71 63 06 ……$. .qc…qc.
F8 71 63 06 CD CD CD CD .qc…… ………
———- Block 203 at 0x0124C3D8: 24 bytes ———-
Call Stack:
f:*bld\self_x86\crt\src\dbgmalloc.c : malloc
d:2d-1.0.1-x-0.12.0\cocos2dx\cocoa\ccautoreleasepool.cpp : cocos2d::CCPoolManager::push
d:2d-1.0.1-x-0.12.0\cocos2dx\ccdirector.cpp : cocos2d::CCDirector::init
d:2d-1.0.1-x-0.12.0\cocos2dx\ccdirector.cpp : cocos2d::CCDirector::sharedDirector
d:2d-1.0.1-x-0.12.0\cocos2dx\platform\win32\cceglview_win32.cpp : cocos2d::CCEGLView::Create
d:world\hello world\classes\appdelegate.cpp : AppDelegate::initInstance
d:2d-1.0.1-x-0.12.0\cocos2dx\platform\win32\ccapplication_win32.cpp : cocos2d::CCApplication::run
d:world\hello world\win32\main.cpp : wWinMain
f:*bld\self_x86\crt\src\crtexe.c :**tmainCRTStartup
f:*bld\self_x86\crt\src\crtexe.c : wWinMainCRTStartup
0x7C817077 : RegisterWaitForInputIdle
Data:
18 47 30 10 06 00 00 00 00 00 00 00 01 00 00 00 .G0…… ………
00 CD CD CD 30 C4 24 01 ….0.$. ………
———- Block 202 at 0x0124C390: 8 bytes ———-
Call Stack:
f:*bld\self_x86\crt\src\dbgmalloc.c : malloc
d:2d-1.0.1-x-0.12.0\cocos2dx\ccdirector.cpp : cocos2d::CCDirector::init
d:2d-1.0.1-x-0.12.0\cocos2dx\ccdirector.cpp : cocos2d::CCDirector::sharedDirector
d:2d-1.0.1-x-0.12.0\cocos2dx\platform\win32\cceglview_win32.cpp : cocos2d::CCEGLView::Create
d:world\hello world\classes\appdelegate.cpp : AppDelegate::initInstance
d:2d-1.0.1-x-0.12.0\cocos2dx\platform\win32\ccapplication_win32.cpp : cocos2d::CCApplication::run
d:world\hello world\win32\main.cpp : wWinMain
f:*bld\self_x86\crt\src\crtexe.c :*tmainCRTStartup
f:*bld\self_x86\crt\src\crtexe.c : wWinMainCRTStartup
0x7C817077 : RegisterWaitForInputIdle
Data:
BD 66 C9 50 C8 EA 0B 00 .f.P…. ………
———- Block 201 at 0x0124C348: 10 bytes ———-
Call Stack:
f:*bld\self_x86\crt\src\dbgmalloc.c (56): malloc
f:*bld\self_x86\crt\src\newaop.cpp : operator new[]
d:2d-1.0.1-x-0.12.0\cocos2dx\ccdirector.cpp : cocos2d::CCDirector::init
d:2d-1.0.1-x-0.12.0\cocos2dx\ccdirector.cpp : cocos2d::CCDirector::sharedDirector
d:2d-1.0.1-x-0.12.0\cocos2dx\platform\win32\cceglview_win32.cpp : cocos2d::CCEGLView::Create
d:world\hello world\classes\appdelegate.cpp : AppDelegate::initInstance
d:2d-1.0.1-x-0.12.0\cocos2dx\platform\win32\ccapplication_win32.cpp : cocos2d::CCApplication::run
d:world\hello world\win32\main.cpp : wWinMain
f:*bld\self_x86\crt\src\crtexe.c (547): *tmainCRTStartup
f:*bld\self_x86\crt\src\crtexe.c : wWinMainCRTStartup
0x7C817077 : RegisterWaitForInputIdle
Data:
36 30 2E 32 00 CD CD CD CD CD 60.2…. ………
———- Block 200 at 0x0124C300: 8 bytes ———-
Call Stack:
f:*bld\self_x86\crt\src\dbgmalloc.c : malloc
c:files\microsoft visual studio 10.0\vc\include\xmemory : std::*Allocatestd::_Container_proxy
c:files\microsoft visual studio 10.0\vc\include\xmemory : std::allocatorstd::_Container_proxy::allocate
c:files\microsoft visual studio 10.0\vc\include\vector : std::*Vector_val<cocos2d::CCScene *,std::allocator<cocos2d::CCScene *> >::*Vector_val<cocos2d::CCScene *,std::allocator<cocos2d::CCScene *> >
c:files\microsoft visual studio 10.0\vc\include\vector : std::vector<cocos2d::CCScene *,std::allocator<cocos2d::CCScene *> >::vector<cocos2d::CCScene *,std::allocator<cocos2d::CCScene *> >
d:2d-1.0.1-x-0.12.0\cocos2dx\include\ccmutablearray.h : cocos2d::CCMutableArray<cocos2d::CCScene *>::CCMutableArray<cocos2d::CCScene *>
d:2d-1.0.1-x-0.12.0\cocos2dx\ccdirector.cpp : cocos2d::CCDirector::init
d:2d-1.0.1-x-0.12.0\cocos2dx\ccdirector.cpp : cocos2d::CCDirector::sharedDirector
d:2d-1.0.1-x-0.12.0\cocos2dx\platform\win32\cceglview_win32.cpp : cocos2d::CCEGLView::Create
d:world\hello world\classes\appdelegate.cpp : AppDelegate::initInstance
d:2d-1.0.1-x-0.12.0\cocos2dx\platform\win32\ccapplication_win32.cpp : cocos2d::CCApplication::run
d:world\hello world\win32\main.cpp : wWinMain
f:*bld\self_x86\crt\src\crtexe.c :*tmainCRTStartup
f:*bld\self_x86\crt\src\crtexe.c : wWinMainCRTStartup
0x7C817077 : RegisterWaitForInputIdle
Data:
AC C2 24 01 00 00 00 00 …$…… ………
———- Block 199 at 0x0124C298: 40 bytes ———-
Call Stack:
f:*bld\self_x86\crt\src\dbgmalloc.c (56): malloc
d:2d-1.0.1-x-0.12.0\cocos2dx\ccdirector.cpp (93): cocos2d::CCDirector::init
d:2d-1.0.1-x-0.12.0\cocos2dx\ccdirector.cpp (76): cocos2d::CCDirector::sharedDirector
d:2d-1.0.1-x-0.12.0\cocos2dx\platform\win32\cceglview_win32.cpp (250): cocos2d::CCEGLView::Create
d:world\hello world\classes\appdelegate.cpp (30): AppDelegate::initInstance
d:2d-1.0.1-x-0.12.0\cocos2dx\platform\win32\ccapplication_win32.cpp (46): cocos2d::CCApplication::run
d:world\hello world\win32\main.cpp (16): wWinMain
f:*bld\self_x86\crt\src\crtexe.c :**tmainCRTStartup
f:*bld\self_x86\crt\src\crtexe.c (371): wWinMainCRTStartup
0x7C817077 (File and line number not available): RegisterWaitForInputIdle
Data:
C4 6A 32 10 05 00 00 00 00 00 00 00 01 00 00 00 .j2…… ………
00 CD CD CD 00 C3 24 01 68 64 24 01 68 64 24 01 ……$. hd$.hd$.
6C 64 24 01 CD CD CD CD ld$…… ………

Visual Leak Detector detected 11 memory leaks.

This stuff

c:files\microsoft visual studio 10.0\vc\include\xmemory

may be an issue with VLD.

No, I was wrong. Those are our fault, we need to ‘retain()’ less :wink: