Skip to content

DPL: Fix Array2D and Variant memory leaks and ownership issues - #15880

Open
aalkin wants to merge 2 commits into
AliceO2Group:devfrom
aalkin:fix-array2d-variant-storage
Open

aalkin wants to merge 2 commits into
AliceO2Group:devfrom
aalkin:fix-array2d-variant-storage

Conversation

@aalkin

@aalkin aalkin commented Oct 1, 2026

Copy link
Copy Markdown
Member
  • Ensure standard move and copy semantics for Array2D and Variant.
  • For Variant, explicitly go through the stored object's copy/move/destroy, or manage manually allocated buffer.
  • Add tests.

The copy and move assignment operators overwrote the data pointer
without releasing the previous buffer, leaking it on every assignment
to a non-empty array

Copy self-assignment also allocated the new buffer before reading from
the source, so the array was filled from its own uninitialised memory.

Now guards against self-assignment and releases the old buffer.
@aalkin
aalkin requested a review from a team as a code owner October 1, 2026 09:07
@aalkin
aalkin requested a review from ktf October 1, 2026 09:07
Copy and move of Variants holding Array2D, LabeledArray or string array
values copied the storage byte by byte, so copies shared the same heap
buffers, and the destructor never destroyed these objects, leaking them.
Assignments never released the previous content, move assignment of
strings and arrays duplicated the buffer and dropped the original one,
and move assignment of string arrays corrupted the source vector.
@aalkin
aalkin force-pushed the fix-array2d-variant-storage branch from 09809b6 to e9b38f1 Compare October 1, 2026 11:30

This branch has not been deployed

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant