I have implemented the solution from this question in my cffi
code:
In an effort to remove a clearly observable memory leak in python3. I have already reduced this memory leak, and identified a different culprit (opencv-python
), which is something I can't control, but I do see valgrind complaining that I've mismatched free | delete | delete []
.
So, the question becomes: how do I delete []
a thing?
I have tried defining a deletion method in the cdecl
header for cffi
:
void destroyArr(void * arr){ delete [] arr; }
However this yields errors when I map the header onto a dl. There must be some way to control dynamically allocated arrays returned by a library that does not define an interface that accepts a new
pointer...the question is: how?
** (posted prior to the comments) I understand that delete []
is not strictly part of the C standard, but neither is new
; cffi
has supported new
, but not delete | delete []
..