Changeset: d90afd5569c3 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d90afd5569c3
Modified Files:
        monetdb5/extras/pyapi/connection.c
        monetdb5/extras/pyapi/pyapi.c
Branch: pythonudf
Log Message:

Properly clean up BATs returned from loopback queries.


diffs (41 lines):

diff --git a/monetdb5/extras/pyapi/connection.c 
b/monetdb5/extras/pyapi/connection.c
--- a/monetdb5/extras/pyapi/connection.c
+++ b/monetdb5/extras/pyapi/connection.c
@@ -70,6 +70,7 @@ static PyObject *
                 }
                 PyDict_SetItem(result, 
PyString_FromString(output->cols[i].name), numpy_array);
                 Py_DECREF(numpy_array);
+                BBPunfix(b->batCacheid);
             }
             _connection_cleanup_result(output);
             return result;
diff --git a/monetdb5/extras/pyapi/pyapi.c b/monetdb5/extras/pyapi/pyapi.c
--- a/monetdb5/extras/pyapi/pyapi.c
+++ b/monetdb5/extras/pyapi/pyapi.c
@@ -694,9 +694,9 @@ str PyAPIeval(Client cntxt, MalBlkPtr mb
                                     if (msg != MAL_SUCCEED) {
                                         goto wrapup;
                                     }
-                                    BBPunfix(col.b);
                                     output->cols[i].b = ret_bat->batCacheid;
                                 }
+                                BBPunfix(col.b);
                             }
 
                             // first obtain the total size of the shared 
memory region
@@ -717,6 +717,7 @@ str PyAPIeval(Client cntxt, MalBlkPtr mb
                                     size += sizeof(Heap);                      
                       //[VHEAP]
                                     size += b->T->vheap->size;                 
                       //[VHEAPDATA]
                                 }
+                                BBPunfix(b->batCacheid);
                             }
 
                             query_ptr->memsize = size;
@@ -765,6 +766,7 @@ str PyAPIeval(Client cntxt, MalBlkPtr mb
                                     memcpy(result_ptr + position, 
b->T->vheap->base, b->T->vheap->size);
                                     position += b->T->vheap->size;
                                 }
+                                BBPunfix(b->batCacheid);
                             }
                             //detach the main process from this piece of 
shared memory so the child process can delete it
                             _connection_cleanup_result(output);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to