SQLCloseCursor() or SQLFreeStmt does not free memory allcated to read CLOB field in Oracle.

From: Vadivel Subramaniam <vadivel(dot)subramaniam(at)flextronicssoftware(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: SQLCloseCursor() or SQLFreeStmt does not free memory allcated to read CLOB field in Oracle.
Date: 2005-07-01 09:04:32
Message-ID: OF658CBCAC.5846AEF9-ON65257031.003139F6-65257031.0031DAE1@flextronicssoftware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Hi,

This is query realated to ODBC and CLOB field in Oracle. I feel some of
you might have faced similar issue. Any hint would help me.


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    strcpy(pQuery, "SELECT clobdata FROM
clobtable")


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


The statement and connection handles are 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 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.

*********************** FSS-Private ***********************
"DISCLAIMER: This message is proprietary to Flextronics Software Systems
Limited (FSS) and is intended solely for the use of the
individual to whom it is addressed. It may contain privileged or
confidential information and should not be circulated or used for
any purpose other than for what it is intended. If you have received this
message in error, please notify the originator immediately.
If you are not the intended recipient, you are notified that you are
strictly prohibited from using, copying, altering, or disclosing
the contents of this message. FSS accepts no responsibility for loss or
damage arising from the use of the information transmitted
by this email including damage from virus."

Browse pgsql-sql by date

  From Date Subject
Next Message Erik Wasser 2005-07-01 13:58:46 'show full processlist' in postgres?
Previous Message KÖPFERL Robert 2005-07-01 08:52:48 UNIT-tests and SQL