-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem in OCI_CollFree() #1
Comments
Hi, Can you provide a working sample code that demonstrate the leak ? Thanks |
My test Code just like this:
} VS2010 platform, oracle 11g, OCI_CHARSET_ANSI |
Thanks. I will check the issue asap |
Hi, There is no memroy leak but rather memory retention (the memory is freed when calling OCI_Cleanup(). Regards, Vincent |
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. i will commit a fix for that these evening ! |
Fix committed :) |
Hi vrogier,
When I use function OCI_CollFree(), I find it does not work well. I check the source code, in the file
collection.c : line 147:
/* free data element /
if (coll->elem)
{
coll->elem->hstate = OCI_OBJECT_FETCHED_DIRTY;
OCI_ElemFree(coll->elem);
coll->elem = NULL;
}
I guess the coll handle only free one elem, not free all elem in the collection, it may lead to memory leak.
I write some sample code like this:
OCI_Object GEOMETRY = NULL;
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);
}
for(int i = 0; i < OCI_CollGetSize(coll); ++i)
{
OCI_Elem elem = OCI_CollGetElem(coll,i);
if (elem)
{
elem ->hstate = OCI_OBJECT_FETCHED_DIRTY;
OCI_ElemFree(elem);
elem = NULL;
}
}
The text was updated successfully, but these errors were encountered: