Rename ArenaAllocator -> Arena
This commit is contained in:
@@ -1,27 +1,27 @@
|
||||
#include "arena_allocator.hpp"
|
||||
#include "arena.hpp"
|
||||
#include "format.hpp"
|
||||
#include <cstring>
|
||||
#include <doctest/doctest.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
TEST_CASE("ArenaAllocator basic construction") {
|
||||
ArenaAllocator arena;
|
||||
TEST_CASE("Arena basic construction") {
|
||||
Arena arena;
|
||||
CHECK(arena.num_blocks() == 0);
|
||||
CHECK(arena.used_bytes() == 0);
|
||||
CHECK(arena.total_allocated() == 0);
|
||||
CHECK(arena.available_in_current_block() == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("ArenaAllocator custom initial size") {
|
||||
ArenaAllocator arena(2048);
|
||||
TEST_CASE("Arena custom initial size") {
|
||||
Arena arena(2048);
|
||||
CHECK(arena.num_blocks() == 0);
|
||||
CHECK(arena.total_allocated() == 0);
|
||||
CHECK(arena.available_in_current_block() == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("ArenaAllocator basic allocation") {
|
||||
ArenaAllocator arena;
|
||||
TEST_CASE("Arena basic allocation") {
|
||||
Arena arena;
|
||||
|
||||
SUBCASE("allocate zero bytes returns nullptr") {
|
||||
void *ptr = arena.allocate_raw(0);
|
||||
@@ -46,8 +46,8 @@ TEST_CASE("ArenaAllocator basic allocation") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("ArenaAllocator alignment") {
|
||||
ArenaAllocator arena;
|
||||
TEST_CASE("Arena alignment") {
|
||||
Arena arena;
|
||||
|
||||
SUBCASE("default alignment") {
|
||||
void *ptr = arena.allocate_raw(1);
|
||||
@@ -66,14 +66,14 @@ TEST_CASE("ArenaAllocator alignment") {
|
||||
}
|
||||
|
||||
SUBCASE("alignment with larger allocations") {
|
||||
ArenaAllocator fresh_arena;
|
||||
Arena fresh_arena;
|
||||
void *ptr = fresh_arena.allocate_raw(100, 64);
|
||||
CHECK(reinterpret_cast<uintptr_t>(ptr) % 64 == 0);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("ArenaAllocator block management") {
|
||||
ArenaAllocator arena(128);
|
||||
TEST_CASE("Arena block management") {
|
||||
Arena arena(128);
|
||||
|
||||
SUBCASE("single block allocation") {
|
||||
void *ptr = arena.allocate_raw(64);
|
||||
@@ -98,8 +98,8 @@ TEST_CASE("ArenaAllocator block management") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("ArenaAllocator construct template") {
|
||||
ArenaAllocator arena;
|
||||
TEST_CASE("Arena construct template") {
|
||||
Arena arena;
|
||||
|
||||
SUBCASE("construct int") {
|
||||
int *ptr = arena.construct<int>(42);
|
||||
@@ -142,8 +142,8 @@ TEST_CASE("ArenaAllocator construct template") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("ArenaAllocator reset functionality") {
|
||||
ArenaAllocator arena;
|
||||
TEST_CASE("Arena reset functionality") {
|
||||
Arena arena;
|
||||
|
||||
arena.allocate_raw(100);
|
||||
arena.allocate_raw(200);
|
||||
@@ -159,8 +159,8 @@ TEST_CASE("ArenaAllocator reset functionality") {
|
||||
CHECK(arena.used_bytes() == 50);
|
||||
}
|
||||
|
||||
TEST_CASE("ArenaAllocator reset memory leak test") {
|
||||
ArenaAllocator arena(32); // Smaller initial size
|
||||
TEST_CASE("Arena reset memory leak test") {
|
||||
Arena arena(32); // Smaller initial size
|
||||
|
||||
// Force multiple blocks
|
||||
arena.allocate_raw(30); // First block (32 bytes)
|
||||
@@ -191,8 +191,8 @@ TEST_CASE("ArenaAllocator reset memory leak test") {
|
||||
CHECK(arena.used_bytes() == 20);
|
||||
}
|
||||
|
||||
TEST_CASE("ArenaAllocator memory tracking") {
|
||||
ArenaAllocator arena(512);
|
||||
TEST_CASE("Arena memory tracking") {
|
||||
Arena arena(512);
|
||||
|
||||
CHECK(arena.total_allocated() == 0);
|
||||
CHECK(arena.used_bytes() == 0);
|
||||
@@ -210,8 +210,8 @@ TEST_CASE("ArenaAllocator memory tracking") {
|
||||
CHECK(arena.total_allocated() >= 1024);
|
||||
}
|
||||
|
||||
TEST_CASE("ArenaAllocator stress test") {
|
||||
ArenaAllocator arena(1024);
|
||||
TEST_CASE("Arena stress test") {
|
||||
Arena arena(1024);
|
||||
|
||||
SUBCASE("many small allocations") {
|
||||
std::vector<void *> ptrs;
|
||||
@@ -237,13 +237,13 @@ TEST_CASE("ArenaAllocator stress test") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("ArenaAllocator move semantics") {
|
||||
ArenaAllocator arena1(512);
|
||||
TEST_CASE("Arena move semantics") {
|
||||
Arena arena1(512);
|
||||
arena1.allocate_raw(100);
|
||||
size_t used_bytes = arena1.used_bytes();
|
||||
size_t num_blocks = arena1.num_blocks();
|
||||
|
||||
ArenaAllocator arena2 = std::move(arena1);
|
||||
Arena arena2 = std::move(arena1);
|
||||
CHECK(arena2.used_bytes() == used_bytes);
|
||||
CHECK(arena2.num_blocks() == num_blocks);
|
||||
|
||||
@@ -251,16 +251,16 @@ TEST_CASE("ArenaAllocator move semantics") {
|
||||
CHECK(ptr != nullptr);
|
||||
}
|
||||
|
||||
TEST_CASE("ArenaAllocator edge cases") {
|
||||
TEST_CASE("Arena edge cases") {
|
||||
SUBCASE("very small block size") {
|
||||
ArenaAllocator arena(16);
|
||||
Arena arena(16);
|
||||
void *ptr = arena.allocate_raw(8);
|
||||
CHECK(ptr != nullptr);
|
||||
CHECK(arena.num_blocks() == 1);
|
||||
}
|
||||
|
||||
SUBCASE("allocation exactly block size") {
|
||||
ArenaAllocator arena(64);
|
||||
Arena arena(64);
|
||||
void *ptr = arena.allocate_raw(64);
|
||||
CHECK(ptr != nullptr);
|
||||
CHECK(arena.num_blocks() == 1);
|
||||
@@ -271,7 +271,7 @@ TEST_CASE("ArenaAllocator edge cases") {
|
||||
}
|
||||
|
||||
SUBCASE("multiple resets") {
|
||||
ArenaAllocator arena;
|
||||
Arena arena;
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
arena.allocate_raw(100);
|
||||
arena.reset();
|
||||
@@ -290,8 +290,8 @@ struct TestPOD {
|
||||
}
|
||||
};
|
||||
|
||||
TEST_CASE("ArenaAllocator with custom objects") {
|
||||
ArenaAllocator arena;
|
||||
TEST_CASE("Arena with custom objects") {
|
||||
Arena arena;
|
||||
|
||||
TestPOD *obj1 = arena.construct<TestPOD>(42, "first");
|
||||
TestPOD *obj2 = arena.construct<TestPOD>(84, "second");
|
||||
@@ -305,8 +305,8 @@ TEST_CASE("ArenaAllocator with custom objects") {
|
||||
CHECK(std::strcmp(obj2->name, "second") == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("ArenaAllocator geometric growth policy") {
|
||||
ArenaAllocator arena(64);
|
||||
TEST_CASE("Arena geometric growth policy") {
|
||||
Arena arena(64);
|
||||
|
||||
SUBCASE("normal geometric growth doubles size") {
|
||||
arena.allocate_raw(60); // Fill first block
|
||||
@@ -338,8 +338,8 @@ TEST_CASE("ArenaAllocator geometric growth policy") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("ArenaAllocator alignment edge cases") {
|
||||
ArenaAllocator arena;
|
||||
TEST_CASE("Arena alignment edge cases") {
|
||||
Arena arena;
|
||||
|
||||
SUBCASE("unaligned then aligned allocation") {
|
||||
void *ptr1 = arena.allocate_raw(1, 1);
|
||||
@@ -351,20 +351,20 @@ TEST_CASE("ArenaAllocator alignment edge cases") {
|
||||
}
|
||||
|
||||
SUBCASE("large alignment requirements") {
|
||||
ArenaAllocator fresh_arena;
|
||||
Arena fresh_arena;
|
||||
void *ptr = fresh_arena.allocate_raw(1, 128);
|
||||
CHECK(ptr != nullptr);
|
||||
CHECK(reinterpret_cast<uintptr_t>(ptr) % 128 == 0);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("ArenaAllocator realloc functionality") {
|
||||
ArenaAllocator arena;
|
||||
TEST_CASE("Arena realloc functionality") {
|
||||
Arena arena;
|
||||
|
||||
SUBCASE("realloc edge cases") {
|
||||
// realloc with new_size == 0 returns nullptr and reclaims memory if it's
|
||||
// the last allocation
|
||||
ArenaAllocator fresh_arena(256);
|
||||
Arena fresh_arena(256);
|
||||
void *ptr = fresh_arena.allocate_raw(100);
|
||||
size_t used_before = fresh_arena.used_bytes();
|
||||
CHECK(used_before == 100);
|
||||
@@ -374,7 +374,7 @@ TEST_CASE("ArenaAllocator realloc functionality") {
|
||||
CHECK(fresh_arena.used_bytes() == 0); // Memory should be reclaimed
|
||||
|
||||
// Test case where it's NOT the last allocation - memory cannot be reclaimed
|
||||
ArenaAllocator arena2(256);
|
||||
Arena arena2(256);
|
||||
void *ptr1 = arena2.allocate_raw(50);
|
||||
(void)arena2.allocate_raw(50);
|
||||
size_t used_before2 = arena2.used_bytes();
|
||||
@@ -397,7 +397,7 @@ TEST_CASE("ArenaAllocator realloc functionality") {
|
||||
}
|
||||
|
||||
SUBCASE("in-place extension - growing") {
|
||||
ArenaAllocator fresh_arena(1024);
|
||||
Arena fresh_arena(1024);
|
||||
void *ptr = fresh_arena.allocate_raw(100);
|
||||
CHECK(ptr != nullptr);
|
||||
|
||||
@@ -418,7 +418,7 @@ TEST_CASE("ArenaAllocator realloc functionality") {
|
||||
}
|
||||
|
||||
SUBCASE("in-place shrinking") {
|
||||
ArenaAllocator fresh_arena(1024);
|
||||
Arena fresh_arena(1024);
|
||||
void *ptr = fresh_arena.allocate_raw(200);
|
||||
std::memset(ptr, 0xCD, 200);
|
||||
|
||||
@@ -435,7 +435,7 @@ TEST_CASE("ArenaAllocator realloc functionality") {
|
||||
}
|
||||
|
||||
SUBCASE("copy when can't extend in place") {
|
||||
ArenaAllocator fresh_arena(256); // Larger block to avoid edge cases
|
||||
Arena fresh_arena(256); // Larger block to avoid edge cases
|
||||
|
||||
// Allocate first chunk
|
||||
void *ptr1 = fresh_arena.allocate_raw(60);
|
||||
@@ -470,7 +470,7 @@ TEST_CASE("ArenaAllocator realloc functionality") {
|
||||
}
|
||||
|
||||
SUBCASE("copy when insufficient space for extension") {
|
||||
ArenaAllocator fresh_arena(100);
|
||||
Arena fresh_arena(100);
|
||||
|
||||
// Allocate almost all space
|
||||
void *ptr = fresh_arena.allocate_raw(90);
|
||||
@@ -489,7 +489,7 @@ TEST_CASE("ArenaAllocator realloc functionality") {
|
||||
}
|
||||
|
||||
SUBCASE("realloc with custom alignment") {
|
||||
ArenaAllocator fresh_arena(1024);
|
||||
Arena fresh_arena(1024);
|
||||
|
||||
// Allocate with specific alignment
|
||||
void *ptr = fresh_arena.allocate_raw(50, 16);
|
||||
@@ -509,7 +509,7 @@ TEST_CASE("ArenaAllocator realloc functionality") {
|
||||
}
|
||||
|
||||
SUBCASE("realloc stress test") {
|
||||
ArenaAllocator fresh_arena(512);
|
||||
Arena fresh_arena(512);
|
||||
void *ptr = fresh_arena.allocate_raw(50);
|
||||
size_t current_size = 50;
|
||||
|
||||
@@ -536,7 +536,7 @@ TEST_CASE("ArenaAllocator realloc functionality") {
|
||||
|
||||
TEST_CASE("format function fallback codepath") {
|
||||
SUBCASE("single-pass optimization success") {
|
||||
ArenaAllocator arena(128);
|
||||
Arena arena(128);
|
||||
auto result = format(arena, "Hello %s! Number: %d", "World", 42);
|
||||
CHECK(result == "Hello World! Number: 42");
|
||||
CHECK(result.length() == 23);
|
||||
@@ -544,7 +544,7 @@ TEST_CASE("format function fallback codepath") {
|
||||
|
||||
SUBCASE("fallback when speculative formatting fails") {
|
||||
// Create arena with limited space to force fallback
|
||||
ArenaAllocator arena(16);
|
||||
Arena arena(16);
|
||||
|
||||
// Consume most space to leave insufficient room for speculative formatting
|
||||
arena.allocate<char>(10);
|
||||
@@ -561,7 +561,7 @@ TEST_CASE("format function fallback codepath") {
|
||||
}
|
||||
|
||||
SUBCASE("edge case - exactly available space") {
|
||||
ArenaAllocator arena(32);
|
||||
Arena arena(32);
|
||||
arena.allocate<char>(20); // Leave 12 bytes
|
||||
CHECK(arena.available_in_current_block() == 12);
|
||||
|
||||
@@ -574,13 +574,13 @@ TEST_CASE("format function fallback codepath") {
|
||||
|
||||
SUBCASE("allocate_remaining_space postcondition") {
|
||||
// Test empty arena
|
||||
ArenaAllocator empty_arena(64);
|
||||
Arena empty_arena(64);
|
||||
auto space1 = empty_arena.allocate_remaining_space();
|
||||
CHECK(space1.allocated_bytes >= 1);
|
||||
CHECK(space1.allocated_bytes == 64);
|
||||
|
||||
// Test full arena (should create new block)
|
||||
ArenaAllocator full_arena(32);
|
||||
Arena full_arena(32);
|
||||
full_arena.allocate<char>(32); // Fill completely
|
||||
auto space2 = full_arena.allocate_remaining_space();
|
||||
CHECK(space2.allocated_bytes >= 1);
|
||||
@@ -588,7 +588,7 @@ TEST_CASE("format function fallback codepath") {
|
||||
}
|
||||
|
||||
SUBCASE("format error handling") {
|
||||
ArenaAllocator arena(64);
|
||||
Arena arena(64);
|
||||
|
||||
// Test with invalid format (should return empty string_view)
|
||||
// Note: This is hard to trigger reliably across platforms,
|
||||
@@ -598,7 +598,7 @@ TEST_CASE("format function fallback codepath") {
|
||||
}
|
||||
}
|
||||
|
||||
// Test object with non-trivial destructor for ArenaAllocator::Ptr testing
|
||||
// Test object with non-trivial destructor for Arena::Ptr testing
|
||||
class TestObject {
|
||||
public:
|
||||
static int destructor_count;
|
||||
@@ -625,11 +625,11 @@ struct TrivialObject {
|
||||
TrivialObject(int v) : value(v) {}
|
||||
};
|
||||
|
||||
TEST_CASE("ArenaAllocator::Ptr smart pointer functionality") {
|
||||
TEST_CASE("Arena::Ptr smart pointer functionality") {
|
||||
TestObject::reset_counters();
|
||||
|
||||
SUBCASE("construct returns raw pointer for trivially destructible types") {
|
||||
ArenaAllocator arena;
|
||||
Arena arena;
|
||||
|
||||
auto ptr = arena.construct<TrivialObject>(42);
|
||||
static_assert(std::is_same_v<decltype(ptr), TrivialObject *>,
|
||||
@@ -639,23 +639,22 @@ TEST_CASE("ArenaAllocator::Ptr smart pointer functionality") {
|
||||
CHECK(ptr->value == 42);
|
||||
}
|
||||
|
||||
SUBCASE("construct returns ArenaAllocator::Ptr for non-trivially "
|
||||
SUBCASE("construct returns Arena::Ptr for non-trivially "
|
||||
"destructible types") {
|
||||
ArenaAllocator arena;
|
||||
Arena arena;
|
||||
|
||||
auto ptr = arena.construct<TestObject>(42);
|
||||
static_assert(
|
||||
std::is_same_v<decltype(ptr), ArenaAllocator::Ptr<TestObject>>,
|
||||
"construct() should return ArenaAllocator::Ptr for non-trivially "
|
||||
"destructible types");
|
||||
static_assert(std::is_same_v<decltype(ptr), Arena::Ptr<TestObject>>,
|
||||
"construct() should return Arena::Ptr for non-trivially "
|
||||
"destructible types");
|
||||
CHECK(ptr);
|
||||
CHECK(ptr->value == 42);
|
||||
CHECK(TestObject::constructor_count == 1);
|
||||
CHECK(TestObject::destructor_count == 0);
|
||||
}
|
||||
|
||||
SUBCASE("ArenaAllocator::Ptr calls destructor on destruction") {
|
||||
ArenaAllocator arena;
|
||||
SUBCASE("Arena::Ptr calls destructor on destruction") {
|
||||
Arena arena;
|
||||
|
||||
{
|
||||
auto ptr = arena.construct<TestObject>(42);
|
||||
@@ -666,8 +665,8 @@ TEST_CASE("ArenaAllocator::Ptr smart pointer functionality") {
|
||||
CHECK(TestObject::destructor_count == 1);
|
||||
}
|
||||
|
||||
SUBCASE("ArenaAllocator::Ptr move semantics") {
|
||||
ArenaAllocator arena;
|
||||
SUBCASE("Arena::Ptr move semantics") {
|
||||
Arena arena;
|
||||
|
||||
auto ptr1 = arena.construct<TestObject>(42);
|
||||
CHECK(TestObject::constructor_count == 1);
|
||||
@@ -682,8 +681,8 @@ TEST_CASE("ArenaAllocator::Ptr smart pointer functionality") {
|
||||
CHECK(TestObject::destructor_count == 1); // Destructor called
|
||||
}
|
||||
|
||||
SUBCASE("ArenaAllocator::Ptr access operators") {
|
||||
ArenaAllocator arena;
|
||||
SUBCASE("Arena::Ptr access operators") {
|
||||
Arena arena;
|
||||
|
||||
auto ptr = arena.construct<TestObject>(123);
|
||||
|
||||
@@ -703,8 +702,8 @@ TEST_CASE("ArenaAllocator::Ptr smart pointer functionality") {
|
||||
CHECK(static_cast<bool>(ptr) == true);
|
||||
}
|
||||
|
||||
SUBCASE("ArenaAllocator::Ptr reset functionality") {
|
||||
ArenaAllocator arena;
|
||||
SUBCASE("Arena::Ptr reset functionality") {
|
||||
Arena arena;
|
||||
|
||||
auto ptr = arena.construct<TestObject>(42);
|
||||
CHECK(TestObject::constructor_count == 1);
|
||||
@@ -723,8 +722,8 @@ TEST_CASE("ArenaAllocator::Ptr smart pointer functionality") {
|
||||
CHECK(TestObject::destructor_count == 1);
|
||||
}
|
||||
|
||||
SUBCASE("ArenaAllocator::Ptr release functionality") {
|
||||
ArenaAllocator arena;
|
||||
SUBCASE("Arena::Ptr release functionality") {
|
||||
Arena arena;
|
||||
|
||||
auto ptr = arena.construct<TestObject>(42);
|
||||
TestObject *raw_ptr = ptr.release();
|
||||
@@ -739,8 +738,8 @@ TEST_CASE("ArenaAllocator::Ptr smart pointer functionality") {
|
||||
CHECK(TestObject::destructor_count == 1);
|
||||
}
|
||||
|
||||
SUBCASE("ArenaAllocator::Ptr move assignment") {
|
||||
ArenaAllocator arena;
|
||||
SUBCASE("Arena::Ptr move assignment") {
|
||||
Arena arena;
|
||||
|
||||
auto ptr1 = arena.construct<TestObject>(42);
|
||||
auto ptr2 = arena.construct<TestObject>(84);
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "arena_allocator.hpp"
|
||||
#include "arena.hpp"
|
||||
#include "http_handler.hpp"
|
||||
#include "perfetto_categories.hpp"
|
||||
#include <atomic>
|
||||
@@ -12,13 +12,13 @@ std::atomic<int> activeConnections{0};
|
||||
|
||||
// Simple test helper since Connection has complex constructor requirements
|
||||
struct TestConnectionData {
|
||||
ArenaAllocator arena;
|
||||
Arena arena;
|
||||
std::string message_buffer;
|
||||
void *user_data = nullptr;
|
||||
|
||||
void append_message(std::string_view data) { message_buffer += data; }
|
||||
|
||||
ArenaAllocator &get_arena() { return arena; }
|
||||
Arena &get_arena() { return arena; }
|
||||
const std::string &getResponse() const { return message_buffer; }
|
||||
void clearResponse() { message_buffer.clear(); }
|
||||
void reset() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <doctest/doctest.h>
|
||||
|
||||
#include "arena_allocator.hpp"
|
||||
#include "arena.hpp"
|
||||
#include "metric.hpp"
|
||||
|
||||
#include <atomic>
|
||||
@@ -279,7 +279,7 @@ TEST_CASE("callback-based metrics") {
|
||||
[]() { return 42.0; });
|
||||
|
||||
// Callback should be called during render
|
||||
ArenaAllocator arena;
|
||||
Arena arena;
|
||||
auto output = metric::render(arena);
|
||||
CHECK(output.size() > 0);
|
||||
}
|
||||
@@ -288,7 +288,7 @@ TEST_CASE("callback-based metrics") {
|
||||
gauge_family.register_callback({{"type", "callback"}},
|
||||
[]() { return 123.5; });
|
||||
|
||||
ArenaAllocator arena;
|
||||
Arena arena;
|
||||
auto output = metric::render(arena);
|
||||
CHECK(output.size() > 0);
|
||||
}
|
||||
@@ -304,7 +304,7 @@ TEST_CASE("callback-based metrics") {
|
||||
}
|
||||
|
||||
TEST_CASE("prometheus text format rendering") {
|
||||
ArenaAllocator arena;
|
||||
Arena arena;
|
||||
|
||||
// Create some metrics
|
||||
auto counter_family =
|
||||
@@ -463,7 +463,7 @@ TEST_CASE("thread safety") {
|
||||
threads.emplace_back([&]() {
|
||||
start_latch.arrive_and_wait();
|
||||
|
||||
ArenaAllocator arena;
|
||||
Arena arena;
|
||||
auto output = metric::render(arena);
|
||||
if (output.size() > 0) {
|
||||
success_count.fetch_add(1);
|
||||
@@ -503,7 +503,7 @@ TEST_CASE("thread counter cleanup bug") {
|
||||
|
||||
// Measure actual values from within the thread (before ThreadInit
|
||||
// destructor runs)
|
||||
ArenaAllocator thread_arena;
|
||||
Arena thread_arena;
|
||||
auto thread_output = metric::render(thread_arena);
|
||||
|
||||
for (const auto &line : thread_output) {
|
||||
@@ -538,7 +538,7 @@ TEST_CASE("thread counter cleanup bug") {
|
||||
worker.join();
|
||||
|
||||
// Measure values after thread cleanup
|
||||
ArenaAllocator arena;
|
||||
Arena arena;
|
||||
auto output = metric::render(arena);
|
||||
|
||||
double counter_value_after = 0;
|
||||
@@ -615,7 +615,7 @@ TEST_CASE("error conditions") {
|
||||
|
||||
TEST_CASE("memory management") {
|
||||
SUBCASE("arena allocation in render") {
|
||||
ArenaAllocator arena;
|
||||
Arena arena;
|
||||
auto initial_used = arena.used_bytes();
|
||||
|
||||
auto counter_family = metric::create_counter("memory_test", "Memory test");
|
||||
@@ -636,7 +636,7 @@ TEST_CASE("memory management") {
|
||||
}
|
||||
|
||||
SUBCASE("arena reset behavior") {
|
||||
ArenaAllocator arena;
|
||||
Arena arena;
|
||||
|
||||
auto counter_family = metric::create_counter("reset_test", "Reset test");
|
||||
auto counter = counter_family.create({});
|
||||
@@ -659,7 +659,7 @@ TEST_CASE("render output deterministic order golden test") {
|
||||
// Clean slate - reset all metrics before this test
|
||||
metric::reset_metrics_for_testing();
|
||||
|
||||
ArenaAllocator arena;
|
||||
Arena arena;
|
||||
|
||||
// Create a comprehensive set of metrics with deliberate ordering
|
||||
// to test deterministic output
|
||||
|
||||
Reference in New Issue
Block a user