ADO c++ Memory Leak RRS feed

  • Question

  • I am using ADO (c++) to insert records into a SQL CE database. Compiling on Windows XP. When I comment out the "Execute" call, the memory leak goes away. The same code running on Win7 (using msado60.tlb) has no problem.

    #import "msado15.DLL" no_namespace rename("EOF", "EndOfFile")
    HRESULT hr;
    _ConnectionPtr pConn		= NULL;
    IGlobalInterfaceTable	*igt;
    DWORD dwConnectionCookie;
    //I use only ONE connection for the life of the program...
    hr = igt->GetInterfaceFromGlobal(dwConnectionCookie, __uuidof(_Connection), (void **) &pConn);
    if( hr == S_OK )
    	pConn->Execute((_bstr_t)(session.sSqlStatement),NULL, adExecuteNoRecords);
    	pConn = NULL;

    Thursday, March 7, 2013 5:12 PM

All replies

  • Hi SteveInHouston,

    Thank you for your question. 

    I am trying to involve someone more familiar with this topic for a further look at this issue. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated. 

    Thank you for your understanding and support.


    Maggie Luo
    TechNet Community Support

    Monday, March 11, 2013 7:01 AM
  • Any findings on this issue. This is a show stopper. I am writing a windows service that must process approx 12-15 inserts per second, for the life of a job, which is usually a week.  I see the memory leak show up using TaskManager and watching the VMSize parameter slowly climb until we begin to get Virtual Memory Low errors, and my HeapAlloc's beging to fail.


    Monday, March 25, 2013 12:26 PM
  • I think you must use the OLEDB interface with SQL Compact, not ADO - how about using managed code instead?

    Please mark as answer, if this was it. Visit my SQL Server Compact blog Windows 8 Apps Showcase

    Monday, March 25, 2013 1:38 PM
  • Why? Everything else works just fine?
    Monday, March 25, 2013 2:50 PM
  • Hello SteveInHouston,

    There are several potential factors in play here (how you are using smart pointers/raw pointers in your code, whether the Recordset object being returned from the Execute call is being released properly, whether this is specific to ADO or SQL CE, or a combination of the two, does it happen with OLE DB calls directly etc.).

    From a support perspective this question is beyond what we can do here in the forums. If you cannot determine your answer here or on your own, please consider opening a support case with us. Visit this link to see the various support options that are available to better meet your needs: http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone.

    Tuesday, April 2, 2013 12:40 PM