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 -> Memory leaks on OCIEnvCreate ?

Memory leaks on OCIEnvCreate ?

From: Herode <cbrun_at_geomapgis.com>
Date: 26 Apr 2006 02:40:52 -0700
Message-ID: <1146044452.611100.64290@j33g2000cwa.googlegroups.com>


Gentlemen,

Here is my test code :

// 1 - the loop testing the leaks
void TestOCIEnv::test()
{
for ( int i = 0; i < 10000; ++ i ) {
COCIEnvironment env;
env.Initialize();
}
}

// 2 - the invoked methods
COCIEnvironment::~COCIEnvironment()
{
if ( ! m_pEnv ) return;
Terminate();
}

bool COCIEnvironment::Initialize( BOOL bThreaded ) // default = FALSE {
m_initMode = bThreaded ? OCI_THREADED : OCI_DEFAULT; m_initMode |= OCI_OBJECT;

sword st = ::OCIEnvCreate( &m_pEnv, m_initMode, NULL, NULL, NULL, NULL, 0, NULL );
if ( st != OCI_SUCCESS && st != OCI_SUCCESS_WITH_INFO ) { return false;
}

st = ::OCIHandleAlloc( m_pEnv, reinterpret_cast< void** >( &m_pErr ), OCI_HTYPE_ERROR, 0, NULL );
if ( st != OCI_SUCCESS && st != OCI_SUCCESS_WITH_INFO ) { m_pErr = NULL;
return false;
}

return true;
}

void COCIEnvironment::Terminate()
{

::OCITerminate( m_initMode );
::OCIHandleFree( m_pErr, OCI_HTYPE_ERROR );
::OCIHandleFree( m_pErr, OCI_HTYPE_ENV );
m_pEnv = NULL;
m_pErr = NULL;
}

I start the loop with 352Mo memory loaded, and I end it with > 1Go... Whether I comment or not the OCITerminate() or the OCIHandleFree( env ) calls does not make any difference.

Could you tell me what I'm missing ?

Regards,
C. Received on Wed Apr 26 2006 - 04:40:52 CDT

Original text of this message

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