Code Monkey home page Code Monkey logo

Comments (6)

vrogier avatar vrogier commented on June 19, 2024

Hi,

Can you provide a working sample code that demonstrate the leak ?

Thanks

from ocilib.

weexp avatar weexp commented on June 19, 2024

My test Code just like this:
void testOcilib(std::string db_url, std::string user_name, std::string pass_word, std::string TableName)
{

OCI_Connection* connection = 0;
OCI_Transaction* transaction = 0;
OCI_Statement* statement = 0;
OCI_Resultset* results = 0;

int isSus = OCI_Initialize(0, 0, OCI_ENV_CONTEXT);
connection = OCI_ConnectionCreate(db_url.c_str(), user_name.c_str(), pass_word.c_str(), OCI_SESSION_DEFAULT);
transaction = OCI_TransactionCreate(connection, 1, OCI_TRS_NEW, 0);
statement = OCI_StatementCreate(connection);

OCI_TypeInfo* obj_type = OCI_TypeInfoGet(connection, "MDSYS.SDO_GEOMETRY", OCI_TIF_TYPE);
OCI_TypeInfo* coll_type = OCI_TypeInfoGet(connection, "MDSYS.SDO_ORDINATE_ARRAY", OCI_TIF_TYPE);
while(1)
{
    OCI_Coll* sdo_ordinate_array = OCI_CollCreate(coll_type);
    OCI_CollFree(sdo_ordinate_array);
}
//transaction
if (0 != transaction)
{
    OCI_TransactionFree(transaction);
    transaction = 0;
}
//statement
if (0 != statement)
{
    OCI_StatementFree(statement);
    statement = 0;
}
//connection
if (0 != connection)
{
    OCI_ConnectionFree(connection);
    connection = 0;
}
OCI_Cleanup();

return ;

}

VS2010 platform, oracle 11g, OCI_CHARSET_ANSI

from ocilib.

vrogier avatar vrogier commented on June 19, 2024

Thanks.

I will check the issue asap

from ocilib.

vrogier avatar vrogier commented on June 19, 2024

Hi,

There is no memroy leak but rather memory retention (the memory is freed when calling OCI_Cleanup().
When the collection is freed, OCILIB call the oracle method OCIObjectFree() on the collection handle with the flag OCI_OBJECTFREE_NONULL.
The OCI client is maintaining a local cache of objects. with your code, it seems that is does not reuse previously allocated object as it should. Replacing the flag OCI_OBJECTFREE_NONULL by OCI_OBJECTFREE_FORCE forces the cleanup of the object instead of maintaining it in the cache.
And you code sample runs with constant memory.
I will study the impact of changing the flag and may commit it if there is no issue with it.

Regards,

Vincent

from ocilib.

vrogier avatar vrogier commented on June 19, 2024

In fact, after having checked again Oracle documentation, it appears that OCILIB should not use the flag OCI_OBJECTFREE_NONULL but rather pass OCI_DEFAULT. Nothing to do with OCI_OBJECTFREE_FORCE.
With OCI_OBJECTFREE_NONULL , the object indicator structure is not freed !

i will commit a fix for that these evening !

from ocilib.

vrogier avatar vrogier commented on June 19, 2024

Fix committed :)

from ocilib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.