MCPcopy Create free account
hub / github.com/apache/arrow / TestMemoryTracking

Method TestMemoryTracking

cpp/src/arrow/memory_pool_test.h:37–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35 virtual ::arrow::MemoryPool* memory_pool() = 0;
36
37 void TestMemoryTracking() {
38 auto pool = memory_pool();
39
40 uint8_t* data;
41 const auto old_bytes_allocated = pool->bytes_allocated();
42 ASSERT_OK(pool->Allocate(100, &data));
43 EXPECT_EQ(static_cast<uint64_t>(0), reinterpret_cast<uint64_t>(data) % 64);
44 ASSERT_EQ(old_bytes_allocated + 100, pool->bytes_allocated());
45
46 uint8_t* data2;
47 ASSERT_OK(pool->Allocate(27, &data2));
48 EXPECT_EQ(static_cast<uint64_t>(0), reinterpret_cast<uint64_t>(data2) % 64);
49 ASSERT_EQ(old_bytes_allocated + 127, pool->bytes_allocated());
50
51 pool->Free(data, 100);
52 ASSERT_EQ(old_bytes_allocated + 27, pool->bytes_allocated());
53 pool->Free(data2, 27);
54 ASSERT_EQ(old_bytes_allocated, pool->bytes_allocated());
55 }
56
57 void TestOOM() {
58 auto pool = memory_pool();

Callers 2

TYPED_TEST_PFunction · 0.80
ASSERT_OK_AND_ASSIGNFunction · 0.80

Calls 4

memory_poolFunction · 0.50
bytes_allocatedMethod · 0.45
AllocateMethod · 0.45
FreeMethod · 0.45

Tested by

no test coverage detected