Memory consumption

I have problems with memory consumption by ado.recordset object.

The following code from MSDN developers center shows the same probleme,
meaning: if you start the application I would expect, that the memory
consumption shown by taskmanager is fixed on a certain value, but it is
increasing while the application is running.

Can anybody help me with same tipps what went wrong?

modified code from:
#import "C:\Programme\Gemeinsame Dateien\System\Ado\msado15.dll"
no_namespace rename("EOF", "EndOfFile")

#include <oledb.h>

#include <stdio.h>

#include <conio.h>

#include "icrsint.h"

// class extracts only fname,lastname and hire_date from employee table

class CEmployeeRs : public CADORecordBinding {


// Column fname is the 2nd field in the table

ADO_VARIABLE_LENGTH_ENTRY2(2, adVarChar, m_sze_fname,

sizeof(m_sze_fname), le_fnameStatus, FALSE)

// Column lname is the 4th field in the table.

ADO_VARIABLE_LENGTH_ENTRY2(4, adVarChar, m_sze_lname,

sizeof(m_sze_lname), le_lnameStatus, FALSE)

// Column hiredate is the 8th field in the table.

ADO_VARIABLE_LENGTH_ENTRY2(8, adDBDate,m_sze_hiredate,

sizeof(m_sze_hiredate), le_hiredateStatus, TRUE)



CHAR m_sze_fname[21];

ULONG le_fnameStatus;

CHAR m_sze_lname[31];

ULONG le_lnameStatus;

DBDATE m_sze_hiredate;

ULONG le_hiredateStatus;


// Function declarations

inline void TESTHR(HRESULT x) { if FAILED(x) _com_issue_error(x); };

void OpenX();

void PrintProviderError(_ConnectionPtr pConnection);

void PrintComError(_com_error &e);

int main() {

if ( FAILED(::CoInitialize(NULL)) )

return -1;

for (int i=0;i<100000;i++)






void OpenX() {

// Define ADO object pointers. Initialize pointers on define.

// These are in the ADODB:: namespace

_RecordsetPtr pRstEmployee = NULL;

_ConnectionPtr pConnection = NULL;

// Define string variables.

_bstr_t strCnn(" Data Source='TEST'; Initial Catalog='pubs'; Integrated

IADORecordBinding *picRs = NULL; // Interface Pointer declared.

CEmployeeRs emprs; // C++ Class object

DBDATE varDate;

try {

// open connection and record set


pConnection->Open("TEST", "BPBDE", "2702", adConnectUnspecified);


pRstEmployee->Open("Employee", _variant_t((IDispatch *)pConnection,true),

adOpenKeyset, adLockOptimistic, adCmdTable);

// Open an IADORecordBindi