while(b){
  pRecordset=
     pConnection->Execute(strSQL,&vRecsAffected,adOptionUnspecified) ; 
  ...
  ... 
  ...
  pRecordset->Close(); 
}好象执行查询和调用存储过程都有内存泄露,
不间断的循环执行导致系统不停的以每次4k的速度泄露内存,
谁知道如何解决吗,帮帮忙,谢谢?

解决方案 »

  1.   

    pRecordset->Close(); 
    pRecordset = NULL;
      

  2.   

    你的ADO版本太低,低版本的ADO是有4k的内存泄漏问题,升级到MADC2.8和jet4 sp8
      

  3.   

    使用完成后彻底释放pRecordset->Close();
    pRecordset.Release();pRecorset=NULL;CoUninitialize();
      

  4.   

    MSDN Library里面的原话如下:Release Unused ADO Objects
    Whenever possible, release ADO objects as soon as you're done with them. This frees up the database and other resources that might be expensive to hold for an extended period. Explicitly close all objects rather than allowing the object to close itself as it is destroyed.
      

  5.   

    每次执行
    if(!pRecordset->adoEOF)
    {
       int i=0;
    }
    就出现内存泄露
      

  6.   

    换成!pRecordset->GetadoEOF()呢?