Skip to content

Memory leak in pyroot backend #91

Description

@sjoerd-bouma

I have a (by now ancient) script to extract trigger rates that has regularly been broken and unbroken by mattak updates, and although it runs again since the recent fixes to skip_incomplete, I noticed that the memory usage has skyrocketed. Changing the backend to uproot limits the memory usage to something reasonable, so it is pyroot-specific. Some quick debugging in Python hasn't led me anywhere yet, and I'm not sure that I would get anywhere trying to debug the root/c++ stuff.

Here's a MWE that demonstrates the memory usage ballooning

import gc
import mattak.Dataset
import time
import logging
logging.basicConfig()
logger = logging.getLogger()
logger.setLevel(logging.INFO)

n_runs = 0
for run in range(0,2000):

    try:
        d = mattak.Dataset.Dataset(
            station=21, run=run,
            skip_incomplete=False,
            read_daq_status=False, read_run_info=False,
            backend='pyroot'
        )
        d.setEntries((0, d.N()))
        einfo = d.eventInfo()

        n_runs += 1
    except (IOError, ReferenceError, KeyError) as e:
        logger.warning('run error', exc_info=e)
        continue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions