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

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



One issue is that your call to SQLGetData uses the variable 'clobBuffer',
but your declaration uses a variable called 'pClobBuffer':

char *pClobBuffer = new char[10485670]; // 10 MB
...
SQLGetData(stmtHandle, 1, SQL_C_CHAR, clobBuffer, 10485670,&dError);

Was this a typo, or is this buffer allocated elsewhere?


Do you check the return codes from SQLFetch( ), SQLGetData( ),
SQLCloseCursor( )? Did they return SQL_SUCCESS or SQL_SUCCESS_WITH_INFO?

Also, what is the value of 'dError' after you call SQLGetData( )? Does it
seem correct?

Nothing else jumps out at me here as to what is wrong. First I would
suggest pinging EasySoft and Oracle directly to see if they have any
suggestions.



--------------------
| From: Vadivel (csvadivel@xxxxxxxxx)
| Subject: ODBC SQLCloseCursor or SQLFreeHandle does not free the memory of
CLOB field in Oracle.
| Message-ID: <#MKrx8ffFHA.3656@xxxxxxxxxxxxxxxxxxxx>
| Newsgroups: microsoft.public.data.odbc
| Date: Thu, 30 Jun 2005 22:39:03 -0700
| NNTP-Posting-Host: shared2.orcsweb.com 66.129.69.1
| Lines: 1
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.data.odbc:2262
| X-Tomcat-NG: microsoft.public.data.odbc
|
| 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

  • [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)
  • Re: C# Oracle CLOB
    ... I am not sure if anyone has a quick and proofed solution for this. ... Using C# I am trying to insert a new record into oracle database, ... text_search is a CLOB field. ... Anyone suggest a good way to use parameterized queries and to add records to ...
    (microsoft.public.dotnet.framework.adonet)