File tree Expand file tree Collapse file tree 1 file changed +40
-1
lines changed
Expand file tree Collapse file tree 1 file changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,13 @@ std::size_t allocation_count = 0;
4444void * operator new [](std::size_t count) BOOST_CONTAINER_NEW_EXCEPTION_SPECIFIER
4545{
4646 ++allocation_count;
47- return std::malloc (count);
47+ return std::malloc (count ? count : 1u );
48+ }
49+
50+ void * operator new (std::size_t count) BOOST_CONTAINER_NEW_EXCEPTION_SPECIFIER
51+ {
52+ ++allocation_count;
53+ return std::malloc (count ? count : 1u );
4854}
4955
5056void operator delete[] (void *p) BOOST_CONTAINER_DELETE_EXCEPTION_SPECIFIER
@@ -53,6 +59,39 @@ void operator delete[](void *p) BOOST_CONTAINER_DELETE_EXCEPTION_SPECIFIER
5359 return std::free (p);
5460}
5561
62+ void operator delete (void *p) BOOST_CONTAINER_DELETE_EXCEPTION_SPECIFIER
63+ {
64+ --allocation_count;
65+ return std::free (p);
66+ }
67+
68+ #if defined __cpp_aligned_new
69+
70+ void * operator new [](std::size_t count, std::align_val_t ) BOOST_CONTAINER_NEW_EXCEPTION_SPECIFIER
71+ {
72+ ++allocation_count;
73+ return std::malloc (count ? count : 1u );
74+ }
75+
76+ void * operator new (std::size_t count, std::align_val_t ) BOOST_CONTAINER_NEW_EXCEPTION_SPECIFIER
77+ {
78+ ++allocation_count;
79+ return std::malloc (count ? count : 1u );
80+ }
81+
82+ void operator delete[] (void *p, std::align_val_t ) BOOST_CONTAINER_DELETE_EXCEPTION_SPECIFIER
83+ {
84+ --allocation_count;
85+ return std::free (p);
86+ }
87+
88+ void operator delete (void *p, std::align_val_t ) BOOST_CONTAINER_DELETE_EXCEPTION_SPECIFIER
89+ {
90+ --allocation_count;
91+ return std::free (p);
92+ }
93+
94+ #endif
5695#endif // BOOST_CONTAINER_ASAN
5796
5897#ifdef BOOST_MSVC
You can’t perform that action at this time.
0 commit comments