Quantcast
Channel: SQL Server Compact Forum
Viewing all articles
Browse latest Browse all 193

ICommandText::Execute() causes mem leaks?

$
0
0
Howdy folks!

I'm trying the VS2005 addon Deleaker for the first time, and noticed I got about 40 "heap" memory leaks after the following m_pICmdText->Execute() call. Both m_pICmdText and m_pICmdPrepare are released before exiting the program. What else could cause these leaks? I've narrowed it down to only occuring if the execute statment is called. m_ulNumExecutions is 1 and a_pwszQuery is a CREATE TABLE statement:

// Set command sql query
    hr = m_pICmdText->SetCommandText(DBGUID_SQL, a_pwszQuery);
    CHKHR(hr, L"Failed to set command text\n", _ExitExeSql);

    // Prepare command text for execution
    hr = m_pICmdPrepare->Prepare(a_ulNumExecutions);
    CHKHR(hr, L"Failed to prepare command text - Invalid Query\n", _ExitExeSql);

    for(ULONG i=0;i<a_ulNumExecutions;i++)
    {
        //Execute query and place results in m_pIRowset
        hr = m_pICmdText->Execute(NULL, IID_IRowset, NULL, NULL, (IUnknown **) &m_pIRowset);
        CHKHR(hr, L"Failed to execute SQL\n", _ExitExeSql);
    }

Thanks!
Jeff

Viewing all articles
Browse latest Browse all 193

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>