-
Notifications
You must be signed in to change notification settings - Fork 149
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
Memory leak in vector_read
for pyxrootd
#1400
Comments
Another suggestions of type "i don't know what i'm doing": Maybe the delete has to be here after this in the conversion for xrootd/bindings/python/src/Conversions.hh Line 271 in 551521e
analogous to what is done here for xrootd/bindings/python/src/Conversions.hh Lines 248 to 257 in 551521e
|
Would it be better to allocate using a python allocator rather than malloc here? Also there might be an opportunity for copy elision if we can pass a set of pointers into vector_read to be filled. |
But yeah looking at https://docs.python.org/3/c-api/bytes.html#c.PyBytes_FromStringAndSize that's a copy, and as far as I can see the original pointer gets forgotten. I wonder why it doesn't just use the existing ChunkInfo convert routine? |
Thanks guys for reporting it, I will have a look! |
There seems to be a memory leak in the
vector_read
function in the python bindings. To reproduce:When running this through memory-profiler with
i get this plot:
(Tested with xrootd 5.0.3 from conda-forge)
It seems the problem are these buffers which are never deleted:
xrootd/bindings/python/src/PyXRootDFile.cc
Line 611 in 551521e
Not sure if or when it is allowed to delete them, but if i collect the buffers into an array and delete them after the call to
self->file->VectorRead(...)
the memory leak seems to be gone:The text was updated successfully, but these errors were encountered: