Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Software > Ado Data RDS > Memory leak in ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 292 of 305
Post > Topic >>

Memory leak in ADODB Connection15::Open method

by =?Utf-8?B?YW1hciBwYW5kYQ==?= <amarpanda@[EMAIL PROTECTED] May 23, 2007 at 03:26 AM

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\sup****tlibrary\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\sup****tlibrary\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\sup****tlibrary\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
 




 2 Posts in Topic:
Memory leak in ADODB Connection15::Open method
=?Utf-8?B?YW1hciBwYW5kYQ=  2007-05-23 03:26:01 
Re: Memory leak in ADODB Connection15::Open method
"Brian Muth" &l  2007-05-23 09:42:27 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 14:08:05 CST 2008.