Skip to content
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

fix memory leak in VectorPDF #42

Merged
merged 1 commit into from
May 20, 2024
Merged

fix memory leak in VectorPDF #42

merged 1 commit into from
May 20, 2024

Conversation

veprbl
Copy link
Member

@veprbl veprbl commented May 18, 2024

Resolves: eic/EICrecon#1456

cc #36

@veprbl
Copy link
Member Author

veprbl commented May 20, 2024 via email

@c-dilks
Copy link
Member

c-dilks commented May 20, 2024

Guarding memory deallocation behind a macro would expose users of root io enabled builds to memory leak. TObject instances are not owned in ROOT, so the code in this PR is valid in both cases.

No double free in this case?

auto f = new TFile("f.root");
auto v = new VectorPDF();
// ... things that fill `m_Members` ...
v->Write("v");
f->Close();

@veprbl
Copy link
Member Author

veprbl commented May 20, 2024

Guarding memory deallocation behind a macro would expose users of root io enabled builds to memory leak. TObject instances are not owned in ROOT, so the code in this PR is valid in both cases.

No double free in this case?

auto f = new TFile("f.root");
auto v = new VectorPDF();
// ... things that fill `m_Members` ...
v->Write("v");
f->Close();

This wouldn't even work, it's not TNamed. But yes, there is no reason to get double free from that.

@c-dilks
Copy link
Member

c-dilks commented May 20, 2024

This wouldn't even work, it's not TNamed.

It works on ROOT 6.28; TObjects may be written.

But yes, there is no reason to get double free from that.

Ship it! ROOT I/O for this repo is disabled in the spack builds anyway.

@c-dilks c-dilks merged commit 74389b1 into main May 20, 2024
2 checks passed
@c-dilks c-dilks deleted the pr/VectorPDF_mem_leak_fix branch May 20, 2024 17:57
@c-dilks
Copy link
Member

c-dilks commented May 20, 2024

v1.0.8 tagged since eic/EICrecon#1456 is closed.

@wdconinc
Copy link
Contributor

Can someone confirm that this will get ported to IRT2 as well, or included automatically?

@c-dilks
Copy link
Member

c-dilks commented May 20, 2024

@veprbl
Copy link
Member Author

veprbl commented May 20, 2024

This wouldn't even work, it's not TNamed.

It works on ROOT 6.28; TObjects may be written.

Sure, "obviously", you're right, TKey's can be created for TObject, by calling TObject::Write.

@wdconinc
Copy link
Contributor

wdconinc commented May 30, 2024

@veprbl Why did we not catch the memory leak in irt with lsan? Is one of the root suppressions hiding it? Can we narrow it?

@veprbl
Copy link
Member Author

veprbl commented May 30, 2024

One needs to compile with lsan to detect the leaks.

@wdconinc
Copy link
Contributor

Ah right, of course. Duh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stop memory consumption increasing linearly with time
3 participants