Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> ODBC SQLCloseCursor or SQLFreeHandle does not free the memory of CLOB field in Oracle.

ODBC SQLCloseCursor or SQLFreeHandle does not free the memory of CLOB field in Oracle.

From: <csvadivel_at_gmail.com>
Date: 30 Jun 2005 22:08:31 -0700
Message-ID: <1120194511.273925.256630@o13g2000cwo.googlegroups.com>


Hi,

I am using a C++ application that connects to Oracle Database using EasySoft ODBC driver.
I face a strange problem when freeing the memory after i fetch the CLOB data from the Oracle table.

The piece of Code is below,

        char *pClobBuffer = new char[10485670]; // 10 MB

	// Prepare the SQL statement for fetching the mgcRoute Table.
	strcpy(pQuery, "SELECT clobdata FROM clobtable")

	/* Execute the SQL statement. Check for errors. */
	SQLExecDirect(stmtHandle,(SQLCHAR*)pQuery,SQL_NTS);
	SQLFetch(stmtHandle);
	SQLGetData(stmtHandle, 1, SQL_C_CHAR, pClobBuffer,10485670,&dError);
        SQLCloseCursor(stmtHandle);
        delete []pClobBuffer;

The statement and connection handle is closed properly. Still i am seeing the memory usage is exactly increasing by 10 MB(size of the buffer we allocated to read the CLOB) for each query.

This is not a memory leak, it's only the memory usage which is increasing for the process for every query involving this CLOB field.

I tried changing the CLOB to Varchar in the database table, the above piece of Code works without increase in memory usage.

NOTE: We observed there is some special handling required to free the memory buffer allocated to read the CLOB field. In DB2 site they are saying SQLFreeStmt does not free the CLOB fields, FREE Alocator statement must be used. Please see the below link which i refered, but this one is for DB2.

http://publib.boulder.ibm.com/infocenter/db2help/index.jsp?topic=/com.ibm.db2.udb.doc/ad/t0007404.htm

Please suggest me if any special handling is required for ORACLE to free the CLOB data.

Our Env: C++, Solaris, ODBC, ORACLE, EasySoft driver

thanks,
Vadivel. Received on Fri Jul 01 2005 - 00:08:31 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US