RooStats::HypoTestInverterResult merging and leaking

To be able to run frequentist limit search (i.e. toys) I am running 10 toys per job and then want to merge the results. This gives me 1000 files of ~2.5 MB each that need to be merged. The issue is now that I can not merge those files as there seems to be a leak in how RooStats::HypoTestInverterResult is loaded from file and then deleted. Even if I just load it and delete it afterwards, it leaks.

The code snippet used:

    TDirectory::AddDirectory(false);

    RooStats::HypoTestInverterResult *result{};
    size_t count{};
    for (const std::string &f : inputs) {
        count++;

        std::unique_ptr<TFile> file = TNLimitFinder::FS::openFile(f, &status);
        if (status != 0) {
            return status;
        }

        std::cout << "File #" << count << std::endl;

        if (result == nullptr) {
            result = file->Get<RooStats::HypoTestInverterResult>("result_mu_signal");
        } else {
            auto other = std::unique_ptr<RooStats::HypoTestInverterResult>(file->Get<RooStats::HypoTestInverterResult>("result_mu_signal"));
            // result->Add(*other.get());
        }

        file->Close();
    }

Files are open with TFile::Open, I just use a helper function to find them on disk properly.

Loading 50 files of 10 toys each uses 1.5 GB of memory even if I do not keep the loaded object.

I would need one of those files, e.g. per private message.

Sent.

I can report that I am trying precisely the same task and having the same problem.
Furthermore, the resulting merged HypoTestInverterResult causes the following error when being read:

Error in TBufferFile::CheckByteCount: object of class TList read too many bytes: 1437176623 instead of 363434799
TBufferFile::CheckByteCount:0: RuntimeWarning: TList::Streamer() not in sync with data on file
Error in TBufferFile::CheckByteCount: object of class RooStats::HypoTestInverterResult read too many bytes: 363440902 instead of 363436711

It’s definitely leaking, but hard to trace when coming from a file. Is it also leaking when not read from files?

Ok, I think I got the leaks sorted out. Testing on Monday.

Regarding the byte count see this:
https://sft.its.cern.ch/jira/browse/ROOT-10686

Fixes for the memory leaks are coming:

… and merged. You should be able to test tomorrow with root’s nightlies.

https://root.cern/nightlies

Thanks @StephanH! Will test when I have time.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.