I'm using the _ConnectionPtr smartpointer in one of my programs and I've noticed major Handle leaks every time I open up a connection. I'm making sure that I'm closing, releasing, and setting the connection to NULL once I'm done with it. This program is a service and has to run 24/7 and these connections are made almost every 2 minutes.
Here's a snippet of what my code looks like:
try
{
m_bstrMessage);m_adoConnPtr.CreateInstance (__uuidof Connection));
m_adoConnPtr->Open (_bstr_t (strConnection), bstrAppUserName, bstrAppPass, adConnectUnspecified);
}
catch (_com_error &e)
{
return false;
}
catch (...)
{
return false;
}
if (m_adoConnPtr.GetInterfacePtr () != NULL)
{
if (m_adoConnPtr->State == adStateOpen)
{
m_adoConnPtr->Close ();
}
m_adoConnPtr.Release ();
m_adoConnPtr = NULL;
}
Any ideas? Help is greatly appreciated
Here's a snippet of what my code looks like:
try
{
m_bstrMessage);m_adoConnPtr.CreateInstance (__uuidof Connection));
m_adoConnPtr->Open (_bstr_t (strConnection), bstrAppUserName, bstrAppPass, adConnectUnspecified);
}
catch (_com_error &e)
{
return false;
}
catch (...)
{
return false;
}
if (m_adoConnPtr.GetInterfacePtr () != NULL)
{
if (m_adoConnPtr->State == adStateOpen)
{
m_adoConnPtr->Close ();
}
m_adoConnPtr.Release ();
m_adoConnPtr = NULL;
}
Any ideas? Help is greatly appreciated