Memory leak in ADODB Connection15::Open method
- From: amar panda <amar panda@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 23 May 2007 03:23:00 -0700
We have a client server application using ASP, ATL COM and SqlServer. We have
found 36 bytes of memory leak in Connection15::Open method when we ran
Rational Purify and we have no idea why it is happening. Here is the example
code.
"dbbase.cpp"
------------------
void CDBBase::CreateDBHandle (CDBBase& pObj, bool bReadonly)
{
CreateDBHandle (bReadonly);
pObj.CopyDBHandle (this);
}
void CDBBase::CopyDBHandle (CDBBase* pObj)
{
m_pConn = pObj->m_pConn;
m_bDBHandleCreated = false;
}
void CDBBase::CreateDBHandle (bool bReadonly)
{
if (m_pConn == NULL)
{
m_pConn.CreateInstance (AdoGuids.m_Connection);
if (g_CommandTimeout == -1)
InitQueryTimeout();
m_pConn->CommandTimeout = g_CommandTimeout;
m_pConn->Open (
m_bstrLogonString,
bstrEmpty,
bstrEmpty,
ADODB::adConnectUnspecified );
m_bDBHandleCreated = true;
}
}
"msado15.tli"
-------------
inline HRESULT Connection15::Open ( _bstr_t ConnectionString, _bstr_t
UserID, _bstr_t Password, long Options ) {
HRESULT _hr = raw_Open(ConnectionString, UserID, Password, Options);
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
return _hr;
}
Purify is showing a memory leak of 36 bytes in Connection15::Open method
above.
[W] MLK: Memory leak of 36 bytes from 1 block allocated in
ADODB::Connection15::Open(_bstr_t,_bstr_t,_bstr_t,long)
[ImplementationLibrary.dll]
Distribution of leaked blocks
Allocation location
LocalAlloc [C:\WINNT\system32\KERNEL32.DLL]
ADODB::Connection15::Open(_bstr_t,_bstr_t,_bstr_t,long)
[o:\applogic\interm\debug\supportlibrary\msado15.tli:1229]
}
inline HRESULT Connection15::Open ( _bstr_t
ConnectionString, _bstr_t UserID, _bstr_t Password, long Options ) {
=> HRESULT _hr = raw_Open(ConnectionString, UserID,
Password, Options);
if (FAILED(_hr)) _com_issue_errorex(_hr, this,
__uuidof(this));
return _hr;
}
CDBBase::CreateDBHandle(bool)
[d:\broker\common\develop\supportlibrary\dbbase.cpp:121]
m_bstrLogonString,
bstrEmpty,
bstrEmpty,
=> ADODB::adConnectUnspecified );
//m_pConn->PutCursorLocation(ADODB::adUseClient);
// NOTE: Above line is necessary for fetching
resultsets and output parameters.
CDBBase::CreateDBHandle(CDBBase&,bool)
[d:\broker\common\develop\supportlibrary\dbbase.cpp:150]
EXTLOG ("CreateDBHandle(): creating and copying DB
handle");
#endif
=> CreateDBHandle (bReadonly);
pObj.CopyDBHandle (this);
}
We are using MDAC version 2.81, Visual C++ .NET, Microsoft Development
Environment 2003 and Microsoft .NET Framework 1.1
Any help regarding the memory leak fix would be greatly appreciated.
Thanks,
-amar
.
- Follow-Ups:
- Re: Memory leak in ADODB Connection15::Open method
- From: Bob Barrows [MVP]
- Re: Memory leak in ADODB Connection15::Open method
- Prev by Date: Re: Snapshot Isolation Level - how to select?
- Next by Date: Re: Memory leak in ADODB Connection15::Open method
- Previous by thread: Re: Snapshot Isolation Level - how to select?
- Next by thread: Re: Memory leak in ADODB Connection15::Open method
- Index(es):
Relevant Pages
|
|