Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions test/secp256k1_allocation_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ class counting_resource final : public std::pmr::memory_resource {
int main() {
std::cout << "the C library's allocations counted: " << webcpp::test::c_allocations_counted
<< "\n";
// The control: one operator new moves the counter.
// The control: one operator new moves the counter. A call of the function, not a
// new-expression, whose allocation the optimizer may elide ([expr.new]), as -O3 does.
std::size_t const control = webcpp::test::allocations();
delete new int(1); // NOLINT(cppcoreguidelines-owning-memory): the control's allocation
::operator delete(::operator new(sizeof(int)));
BOOST_TEST(webcpp::test::allocations() > control);

counting_resource resource;
Expand Down
Loading