Skip to content

Commit 76df2b9

Browse files
gfphoenix78zhangwenchao
authored andcommitted
Add sized delete operator
1 parent b195300 commit 76df2b9

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/ports/postgres/dbconnector/NewDelete.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
// We do not write #include "dbconnector.hpp" here because we want to rely on
2626
// the search paths, which might point to a port-specific dbconnector.hpp
2727
#include <dbconnector/dbconnector.hpp>
28+
#include <new>
2829

2930
#if _GLIBCXX_USE_CXX11_ABI
3031
#define THROW_BAD_ALLOC
@@ -113,3 +114,17 @@ void
113114
operator delete[](void *ptr, const std::nothrow_t&) NOEXCEPT {
114115
madlib::defaultAllocator().free<madlib::dbal::FunctionContext>(ptr);
115116
}
117+
118+
#ifdef __cpp_sized_deallocation
119+
void
120+
operator delete(void *ptr, std::size_t sz) NOEXCEPT {
121+
(void)sz;
122+
madlib::defaultAllocator().free<madlib::dbal::FunctionContext>(ptr);
123+
}
124+
125+
void
126+
operator delete[](void *ptr, std::size_t sz) NOEXCEPT {
127+
(void)sz;
128+
madlib::defaultAllocator().free<madlib::dbal::FunctionContext>(ptr);
129+
}
130+
#endif

0 commit comments

Comments
 (0)