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



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

/* Execute the SQL statement. Check for errors. */
SQLExecDirect(stmtHandle,(SQLC­HAR*)pQuery,SQL_NTS);
SQLFetch(stmtHandle);
SQLGetData(stmtHandle, 1, SQL_C_CHAR, clobBuffer, 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?t­opic=/com...


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.



**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
.



Relevant Pages

  • ODBC SQLCloseCursor or SQLFreeHandle does not free the memory of CLOB field in Oracle.
    ... 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 ...
    (comp.databases.oracle.misc)
  • [Full-disclosure] Oracle TNS Listener DoS and/or remote memory inspection
    ... Oracle TNS Listener DoS and/or remote memory inspection ... The TNS Listener can be crashed by an attacker causing a Denial of Service; ... Oracle was alerted to this flaw on the 22nd of June 2006. ... The views expressed in this email do not necessarily reflect NGS policy. ...
    (Full-Disclosure)
  • Oracle TNS Listener DoS and/or remote memory inspection
    ... Oracle TNS Listener DoS and/or remote memory inspection ... The TNS Listener can be crashed by an attacker causing a Denial of Service; ... Oracle was alerted to this flaw on the 22nd of June 2006. ... The views expressed in this email do not necessarily reflect NGS policy. ...
    (Bugtraq)
  • Re: Oracle 9.2.0.6 Memory leak
    ... Client applications received some ORA-4030 errors. ... Most of the memory was consumed by Oracle client and background ... this bug. ...
    (comp.databases.oracle.server)
  • Re: strange memory leak
    ... server that is going to host a new JDE EnterpriseOne implementation. ... So far, oracle & JDE are installed, and users are able to log in, ... the machine shipped with 8GB memory, ... When paging space fills up, it means that the system sends out ...
    (comp.unix.aix)