We are using ODBC connection pooling with SQL Server 2000 v5 on Win 2000 v5
sp4.
Each time we get a connection, SQLConnect, we see the memory usage go
up, about 52K. When we return the connection to the pool,
SQLDisconnect, and after the time that the connection remains in pool
expires we see the memory usage drop by about 28K.
Our basic steps for a select are:
SQLAllocHandle(SQL_HANDLE_DBC, hGblEnv, &hdbc);
SQLSetConnectAttr(hdbc, SQL_ATTR_LOGIN_TIMEOUT,
(SQLPOINTER)lLoginTimeOut, 0);
SQLSetConnectAttr(hdbc, SQL_ATTR_ACCESS_MODE,
(SQLPOINTER)SQL_MODE_READ_ONLY, SQL_IS_POINTER);
SQLConnect(hdbc,(SQLCHAR *)szDatabase, SQL_NTS,
(SQLCHAR *)szUserId, SQL_NTS,
(SQLCHAR *)szPassword, SQL_NTS);
SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt);
// Build the select statement
SQLExecDirect(hstmt, (SQLCHAR * )pszSQLStmt, strlen(pszSQLStmt));
SQLFetch(hstmt);
SQLFreeHandle (SQL_HANDLE_STMT, hstmt);
SQLDisconnect(hdbc);
Same memory leak occurs in DB2, but that's another forum.