core: use ::operator delete for RVec heavy storage on Windows#22460
core: use ::operator delete for RVec heavy storage on Windows#22460wacfrr wants to merge 6 commits into
Conversation
|
This will need a matching change in the RNTuple treatment of RVecs |
Test Results 22 files 22 suites 3d 14h 57m 49s ⏱️ For more details on these failures, see this check. Results for commit 91e7252. ♻️ This comment has been updated with latest results. |
|
/format Hi, thanks for triggering the CI! I have just run the local test suites for both Regarding the I've left a Let's monitor the rest of the CI matrix results to see if there are any other hidden regressions. Thanks again! I understand that this is a critical modification involving core behaviors, and I would be more than happy to continue our discussion on how to properly align this with the rest of the ecosystem. |
|
@wacfrr it seems to be working for |
Can you point where in RNTuple the same change should be applied? |
bellenot
left a comment
There was a problem hiding this comment.
Code indentation + use #ifdef instead of #if
|
And BTW, maybe we could use the Windows version everywhere (i.e. removing the |
Co-authored-by: Bertrand Bellenot <bellenot@users.noreply.github.com>
Co-authored-by: Bertrand Bellenot <bellenot@users.noreply.github.com>
Co-authored-by: Bertrand Bellenot <bellenot@users.noreply.github.com>
Co-authored-by: Bertrand Bellenot <bellenot@users.noreply.github.com>
Co-authored-by: Bertrand Bellenot <bellenot@users.noreply.github.com>
Thanks for the feedback! I completely agree that consolidating this into a unified cross-platform implementation is a great long-term goal for the codebase, and removing the #ifdef entirely would make the maintenance much cleaner. Just a minor thought from my side: while the 2x + 1 growth policy will eventually amortize the heap allocation costs for larger vectors, the current specific layout implementation might still hold a non-trivial performance edge for scenarios heavily dominated by short-lived, small-scale arrays (where we frequently hit the threshold boundary but destroy them before getting the amortized benefits). Perhaps a comprehensive cross-platform benchmark could help clarify the overall performance impact. Either way, I am very glad to defer to your judgment and that of @jblomer on the best path forward for the architecture. Thanks again for taking the time to test and improve this PR! |
This Pull request:
Fixes a cross-module/cross-CRT heap allocation mismatch in
RVecon Windows platforms. This issue can lead to undefined behaviors, memory corruption, or silent exits when memory allocated insideRVecis freed across module boundaries (e.g., between a pre-compiled DLL and JIT-generated code).Changes or fixes:
math/vecops/src/RVec.cxx: InSmallVectorBase::grow_pod, replacedmalloc/realloc/freewith::operator new(std::nothrow)and::operator delete, guarded by#ifdef _WIN32.math/vecops/inc/ROOT/RVec.hxx: InSmallVectorTemplateBase::growand 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
reallocpaths.Checklist:
This PR fixes #22449