Print

Print


There seems to be a memory leak in the vector_read function in the python bindings. To reproduce:

# debug_vector_read.py
import gc
import pyxrootd.client

filename = "root://eospublic.cern.ch//eos/opendata/atlas/OutreachDatasets/2020-01-22/4lep/MC/mc_345060.ggH125_ZZ4lep.4lep.root"

def test():
    f = pyxrootd.client.File()
    res = f.open(filename)
    if not res[0]["ok"]:
        raise IOError(res)
    chunksize = 1024 * 256
    chunks = [(i * chunksize, chunksize) for i in range(5)]
    res = f.vector_read(chunks)
    print(res[0]["message"])
    f.close()

for i in range(20):
    print(i)
    test()
    gc.collect()

When running this through memory-profiler with

mprof run debug_vector_read.py
mprof plot

i get this plot:

memory_leak

(Tested with xrootd 5.0.3 from conda-forge)

It seems the problem are these buffers which are never deleted:

https://github.com/xrootd/xrootd/blob/551521ea7368e3b2a4c7964325e2e7e3fe7ce047/bindings/python/src/PyXRootDFile.cc#L611

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:

no_memory_leak


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/xrootd/xrootd/issues/1400", "url": "https://github.com/xrootd/xrootd/issues/1400", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

Use REPLY-ALL to reply to list

To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1