Skip to content

core: use ::operator delete for RVec heavy storage on Windows#22460

Open
wacfrr wants to merge 1 commit into
root-project:masterfrom
wacfrr:fix-rvec-win32-delete
Open

core: use ::operator delete for RVec heavy storage on Windows#22460
wacfrr wants to merge 1 commit into
root-project:masterfrom
wacfrr:fix-rvec-win32-delete

Conversation

@wacfrr
Copy link
Copy Markdown

@wacfrr wacfrr commented Jun 2, 2026

This Pull request:

Fixes a cross-module/cross-CRT heap allocation mismatch in RVec on Windows platforms. This issue can lead to undefined behaviors, memory corruption, or silent exits when memory allocated inside RVec is freed across module boundaries (e.g., between a pre-compiled DLL and JIT-generated code).

Changes or fixes:

  • math/vecops/src/RVec.cxx: In SmallVectorBase::grow_pod, replaced malloc/realloc/free with ::operator new(std::nothrow) and ::operator delete, guarded by #ifdef _WIN32.

  • math/vecops/inc/ROOT/RVec.hxx: In SmallVectorTemplateBase::grow and destructor-related deallocations, applied the same guarded replacement to ensure all heap operations are unified across the class layout.

These changes are strictly restricted to Windows via platform macros; Linux and macOS targets remain completely untouched to preserve their high-performance native realloc paths.

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

This PR fixes #22449

@wacfrr wacfrr requested a review from dpiparo as a code owner June 2, 2026 15:51
@jblomer
Copy link
Copy Markdown
Contributor

jblomer commented Jun 2, 2026

This will need a matching change in the RNTuple treatment of RVecs

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.

[Windows] Macro df002_dataModel.C crashes on exit or exits silently due to potential RVec/Heap issues across DLL boundaries in Cling JIT

2 participants