fix(daal): declare the placement deletes that match DAAL_NEW_DELETE's placement new #4000
All Vouch review confidence checks passed
Residual risk 0.25 = Change Risk (0.48) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 513 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.373
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #4000"
general
weight: 0.35
Alexandr-Solovev
Description
DAAL_NEW_DELETE()(cpp/daal/include/services/daal_defines.h) declares a class-level placementoperator new(std::size_t, void )(andnew[]) but no matching placementoperator delete(void , void ). MSVC reports C4291 ("no matching operator delete found; memory will not be freed if initialization throws an exception") for every placement new of such a class.That is what the scikit-learn-intelex Windows build in the conda-forge feedstock shows: Cython 3.1+ constructs the
SharedPtrmembers of daal4py'scdefclasses with__Pyx_default_placement_construct, i.e.new (static_cast<void >(x)) T();, so there is one warning per wrappedSharedPtr<...>type (example: conda-forge/scikit-learn-intelex-feedstock#85, Windows job). Cython 3.0 emitted the same placement new inline intp_new; 3.1 only moved it into a helper, which is why the warnings now come with template-instantiation notes.Is it a real leak? No. The placement form constructs into storage the caller already owns (for daal4py, the Python object), so there is nothing to free if the constructor throws, and
SharedPtr's default constructor only sets three pointers to null and cannot throw. The macro has been like this since the first open-source commit.Change. Two no-op placement deletes are added to the macro. They are called only if a constructor throws inside placement new. Ordinary
new/deleteandnew[]/delete[]are unchanged and still go throughdaal_calloc/daal_free;(void , void )is not a usual deallocation function, so it never competes with the existing sizedoperator delete(void , std::size_t).API/ABI. Additive only. The macro is used in 10 public headers, including
class DAAL_EXPORT Base. On Linux the new inline members are not emitted unless used. On Windows, MSVC exports the inline members of a dllexport class, soonedal_core.dllgains twoBasesymbols; no existing symbol, layout or vtable changes, and binaries built against older headers keep working.Tests. New suite
//cpp/daal/src/services/test:tests(registered in//cpp/daal:testsnext to the threading suite),new_delete_unit.cpp:static_asserts thatSharedPtr<int>and aBasesubclass haveoperator delete(void , void )andoperator delete[](void , void ). Without the change the file does not compile (invalid static_cast from void ()(void *, std::size_t)).SharedPtr, and plainnew/delete/new[]/delete[]of aBasesubclass.bazel test --config=host //cpp/daal/src/services/test:tests //cpp/daal/src/threading/test:testspasses. GCC and Clang have no counterpart to C4291, so the warning itself can only be checked on the Windows CI (MSVC); the scikit-learn-intelex side needs this header in a released oneDAL to see the warnings go away.---
<details>
<summary>Checklist:</summary>
Completeness and readability
Testing
Performance
</details>
🤖 Generated with Claude Code