Skip to content

[PWGCF] Fix memory leaks and other issues in GFWCore - #18216

Merged
EmilGorm merged 5 commits into
AliceO2Group:masterfrom
EmilGorm:gfw-cleanup
Oct 8, 2026
Merged

EmilGorm merged 5 commits into
AliceO2Group:masterfrom
EmilGorm:gfw-cleanup

Conversation

@EmilGorm

@EmilGorm EmilGorm commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@github-actions github-actions Bot added the pwgcf label Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

O2 linter results: ❌ 0 errors, ⚠️ 184 warnings, 🔕 16 disabled

@github-actions github-actions Bot changed the title Gfw cleanup [PWGCF] Gfw cleanup Oct 8, 2026
@EmilGorm EmilGorm changed the title [PWGCF] Gfw cleanup [PWGCF] Fix memory leaks and other issues in GFWCore Oct 8, 2026
@EmilGorm
EmilGorm marked this pull request as ready for review October 8, 2026 11:32
@alibuild

alibuild commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/o2 for 301c048 at 2026-10-08 13:46:

## sw/BUILD/O2Physics-latest/log
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGCF/GenericFramework/Core/GFWPowerArray.cxx:45:28: error: redundant move in initialization [-Werror=redundant-move]
ninja: build stopped: subcommand failed.

Full log here.

@alibuild

alibuild commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/code-check for 301c048 at 2026-10-08 13:46:

## sw/BUILD/O2Physics-code-check-latest/log
--
========== List of issues found ==========
++ echo 'Found 18 errors and 397 warnings.'
Found 18 errors and 397 warnings.
++ [[ 18 -gt 0 ]]
++ cat /sw/BUILD/10fd15b8ccf8fb45210b17ad1dfdb7ba83c7b6a3/O2Physics-code-check/errors.txt
PWGCF/GenericFramework/Core/FlowContainer.cxx:419:23: error: Called C++ object pointer is null [clang-analyzer-core.CallAndMessage,-warnings-as-errors]
PWGCF/GenericFramework/Core/FlowContainer.cxx:530:3: error: Potential leak of memory pointed to by 'nam' [clang-analyzer-cplusplus.NewDeleteLeaks,-warnings-as-errors]
PWGCF/GenericFramework/Core/FlowContainer.cxx:712:3: error: Potential leak of memory pointed to by 'nam' [clang-analyzer-cplusplus.NewDeleteLeaks,-warnings-as-errors]
PWGCF/GenericFramework/Core/FlowContainer.cxx:785:3: error: Potential leak of memory pointed to by 'nam' [clang-analyzer-cplusplus.NewDeleteLeaks,-warnings-as-errors]
PWGCF/GenericFramework/Core/FlowContainer.cxx:817:3: error: Potential leak of memory pointed to by 'nam' [clang-analyzer-cplusplus.NewDeleteLeaks,-warnings-as-errors]
PWGCF/GenericFramework/Core/FlowContainer.cxx:835:3: error: Potential leak of memory pointed to by 'nam' [clang-analyzer-cplusplus.NewDeleteLeaks,-warnings-as-errors]
PWGCF/GenericFramework/Core/FlowContainer.cxx:871:3: error: Potential leak of memory pointed to by 'nam' [clang-analyzer-cplusplus.NewDeleteLeaks,-warnings-as-errors]
PWGCF/GenericFramework/Core/FlowContainer.cxx:889:3: error: Potential leak of memory pointed to by 'nam' [clang-analyzer-cplusplus.NewDeleteLeaks,-warnings-as-errors]
PWGCF/GenericFramework/Core/FlowContainer.cxx:949:10: error: Potential leak of memory pointed to by 'l_bins' [clang-analyzer-cplusplus.NewDeleteLeaks,-warnings-as-errors]
PWGCF/GenericFramework/Core/GFWPowerArray.cxx:32:3: error: no header providing "int64_t" is directly included [misc-include-cleaner,-warnings-as-errors]
PWGCF/GenericFramework/Core/GFWPowerArray.cxx:45:19: error: std::move of the const variable 'hars' has no effect; remove std::move() or make the variable non-const [performance-move-const-arg,-warnings-as-errors]
PWGCF/GenericFramework/Core/GFW.cxx:85:28: error: the parameter 'refName' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param,-warnings-as-errors]
PWGCF/GenericFramework/Core/GFW.cxx:89:5: error: 'push_back' is called inside a loop; consider pre-allocating the container capacity before the loop [performance-inefficient-vector-operation,-warnings-as-errors]
PWGCF/GenericFramework/Core/GFW.cxx:90:13: error: passing result of std::move() as a const reference argument; no move will actually happen [performance-move-const-arg,-warnings-as-errors]
PWGCF/GenericFramework/Core/GFW.cxx:92:28: error: the parameter 'refName' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param,-warnings-as-errors]
PWGCF/GenericFramework/Core/GFW.cxx:96:5: error: 'push_back' is called inside a loop; consider pre-allocating the container capacity before the loop [performance-inefficient-vector-operation,-warnings-as-errors]
PWGCF/GenericFramework/Core/GFW.cxx:97:13: error: passing result of std::move() as a const reference argument; no move will actually happen [performance-move-const-arg,-warnings-as-errors]
PWGCF/GenericFramework/Core/GFW.cxx:139:5: error: 'push_back' is called inside a loop; consider pre-allocating the container capacity before the loop [performance-inefficient-vector-operation,-warnings-as-errors]
++ [[ 397 -gt 0 ]]
++ cat /sw/BUILD/10fd15b8ccf8fb45210b17ad1dfdb7ba83c7b6a3/O2Physics-code-check/warnings.txt
PWGCF/GenericFramework/Core/FlowContainer.cxx:45:40: warning: use nullptr [modernize-use-nullptr]
PWGCF/GenericFramework/Core/FlowContainer.cxx:46:44: warning: use nullptr [modernize-use-nullptr]
PWGCF/GenericFramework/Core/FlowContainer.cxx:50:48: warning: use nullptr [modernize-use-nullptr]
PWGCF/GenericFramework/Core/FlowContainer.cxx:52:51: warning: use nullptr [modernize-use-nullptr]
PWGCF/GenericFramework/Core/FlowContainer.cxx:53:41: warning: use nullptr [modernize-use-nullptr]
PWGCF/GenericFramework/Core/FlowContainer.cxx:55:42: warning: use nullptr [modernize-use-nullptr]
PWGCF/GenericFramework/Core/FlowContainer.cxx:58:56: warning: use nullptr [modernize-use-nullptr]
PWGCF/GenericFramework/Core/FlowContainer.cxx:59:60: warning: use nullptr [modernize-use-nullptr]
PWGCF/GenericFramework/Core/FlowContainer.cxx:63:64: warning: use nullptr [modernize-use-nullptr]
PWGCF/GenericFramework/Core/FlowContainer.cxx:65:67: warning: use nullptr [modernize-use-nullptr]
PWGCF/GenericFramework/Core/FlowContainer.cxx:66:57: warning: use nullptr [modernize-use-nullptr]
PWGCF/GenericFramework/Core/FlowContainer.cxx:68:58: warning: use nullptr [modernize-use-nullptr]
PWGCF/GenericFramework/Core/FlowContainer.cxx:79:23: warning: statement should be inside braces [readability-braces-around-statements]
PWGCF/GenericFramework/Core/FlowContainer.cxx:93:94: warning: 'data' should be used for accessing the data pointer instead of taking the address of the 0-th element [readability-container-data-pointer]
PWGCF/GenericFramework/Core/FlowContainer.cxx:94:52: warning: statement should be inside braces [readability-braces-around-statements]
PWGCF/GenericFramework/Core/FlowContainer.cxx:97:7: warning: implicit conversion 'int' -> 'bool' [readability-implicit-bool-conversion]
PWGCF/GenericFramework/Core/FlowContainer.cxx:118:23: warning: use nullptr [modernize-use-nullptr]
PWGCF/GenericFramework/Core/FlowContainer.cxx:120:52: warning: statement should be inside braces [readability-braces-around-statements]
PWGCF/GenericFramework/Core/FlowContainer.cxx:122:7: warning: implicit conversion 'int' -> 'bool' [readability-implicit-bool-conversion]
PWGCF/GenericFramework/Core/FlowContainer.cxx:134:13: warning: statement should be inside braces [readability-braces-around-statements]
PWGCF/GenericFramework/Core/FlowContainer.cxx:146:16: warning: statement should be inside braces [readability-braces-around-statements]
PWGCF/GenericFramework/Core/FlowContainer.cxx:153:5: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
[0 more errors; see full log]

Full log here.

@alibuild

alibuild commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/staging for 301c048 at 2026-10-08 13:49:

## sw/BUILD/O2Physics-latest/log
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGCF/GenericFramework/Core/GFWPowerArray.cxx:45:28: error: redundant move in initialization [-Werror=redundant-move]
ninja: build stopped: subcommand failed.

Full log here.

@EmilGorm
EmilGorm enabled auto-merge (squash) October 8, 2026 19:47

@alibuild alibuild left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approving on behalf of @EmilGorm.

@EmilGorm
EmilGorm merged commit 8bb3f2f into AliceO2Group:master Oct 8, 2026
15 checks passed
@vkucera

vkucera commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Thanks a lot for the fixes!

Comment on lines +532 to +534
const TString nam(corrN2->GetName());
delete corrN2;
rethist->SetName(nam->Data());
rethist->SetName(nam.Data());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I quite don't understand why nam is needed in the first place. Can you not just do directly this?

Suggested change
const TString nam(corrN2->GetName());
delete corrN2;
rethist->SetName(nam->Data());
rethist->SetName(nam.Data());
rethist->SetName(corrN2->GetName());
delete corrN2;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants