c++ - CDatabase Leak even after calling Close -


my application leaks while executing following code piece. memory not released after calling close() on cdatabase.

how can correct leak without destroying cdatabase object?

cdatabase db; int count = 2000; (int i=0; <count; ++i) {     bool bres = db.openex("dsn=icedbserver;uid=sa;pwd=iceconnect200");     db.close(); } 

the call stack of leak location given below

+  133154 ( 133154 -      0)   2001 allocs  backtrace477 +    2001 (   2001 -      0)    backtrace477    allocations      ntdll!rtlallocateheap+00001292     ntdll!ldrpcopyunicodestring+000000b1     ntdll!ldrpresolvedllname+000002ce     ntdll!ldrpmapdll+000002c1     ntdll!ldrploaddll+00000251     ntdll!ldrloaddll+000001c8     kernel32!loadlibraryexw+0000024d     odbc32!loaddriver+00000235     odbc32!sqldriverconnectw+00000c11     odbc32!sqldriverconnect+000001bb     mfc90!cdatabase::connect+0000009e (f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\dbcore.cpp, 745)     mfc90!cdatabase::openex+00000089 (f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\dbcore.cpp, 289)     testapp!ctestappdlg::onbnclickedbutton1+0000006a (d:\test\testapp\testapp\testappdlg.cpp, 162)     mfc90!_afxdispatchcmdmsg+000000c4 (f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\cmdtarg.cpp, 82)     mfc90!ccmdtarget::oncmdmsg+000001a4 (f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\cmdtarg.cpp, 381)     mfc90!cpropertysheet::oncmdmsg+00000032 (f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\dlgprop.cpp, 814)     mfc90!cwnd::oncommand+00000100 (f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\wincore.cpp, 2364)     mfc90!cwnd::onwndmsg+0000005f (f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\wincore.cpp, 1769)     mfc90!cwnd::windowproc+00000038 (f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\wincore.cpp, 1755)     mfc90!afxcallwndproc+00000100 (f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\wincore.cpp, 240)     mfc90!afxwndproc+00000059 (f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\wincore.cpp, 402)     mfc90!afxwndprocbase+00000053 (f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\afxstate.cpp, 441)     user32!usercallwinproccheckwow+000001f9     user32!dispatchclientmessage+000000c3     user32!_fndword+0000002d     ntdll!kiusercallbackdispatchercontinue+00000000     user32!zwusermessagecall+0000000a 

when program opens first database connection, loads database libraries memory. following connections not need lot of memory because of connection pooling. closing connections not unload loaded before in instant, , parts stay in memory until program exits.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -