Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> OCIEnvInit() and heavy memmory leaks
Hi gentlemen,
here is a simplified piece of code for testing resource management :
1 - the allocation and de-allocation methods :
class COCIEnvironment {
bool COCIEnvironment::Initialize( BOOL bThreaded )
{
m_initMode = bThreaded ? OCI_THREADED : OCI_DEFAULT;
m_initMode |= OCI_OBJECT;
// Allocation of handle m_pEnv
::OCIEnvCreate( &m_pEnv, m_initMode, NULL, NULL, NULL, NULL, 0, NULL
);
// Allocation of an error handle
::OCIHandleAlloc( m_pEnv, reinterpret_cast< void** >( &m_pErr ),
OCI_HTYPE_ERROR, 0, NULL );
return true;
}
void COCIEnvironment::Terminate()
{
::OCIHandleFree( m_pErr, OCI_HTYPE_ERROR );
::OCITerminate( m_initMode );
m_pEnv = NULL;
m_pErr = NULL;
}
[...]
};
2 - the test code :
COCIEnvironment env;
cout << "Construction OCIEnvironment" << endl;
for ( int i = 0; i < 20000; ++ i ) {
env.Initialize();
env.Terminate();
}
While performing this loop, the system available memory dramatically falls. I loose some 700 Mo in a few seconds. Hence, I suspect heavy leaks in the above code, but I am definitely unable to find and explain them.
Have you some clues to help me ? Received on Mon Mar 13 2006 - 03:02:57 CST