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

Method TestReallocate

cpp/src/arrow/memory_pool_test.h:69–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67 }
68
69 void TestReallocate() {
70 auto pool = memory_pool();
71
72 uint8_t* data;
73 ASSERT_OK(pool->Allocate(10, &data));
74 ASSERT_EQ(10, pool->bytes_allocated());
75 data[0] = 35;
76 data[9] = 12;
77
78 // Expand
79 ASSERT_OK(pool->Reallocate(10, 20, &data));
80 ASSERT_EQ(data[9], 12);
81 ASSERT_EQ(20, pool->bytes_allocated());
82
83 // Shrink
84 ASSERT_OK(pool->Reallocate(20, 5, &data));
85 ASSERT_EQ(data[0], 35);
86 ASSERT_EQ(5, pool->bytes_allocated());
87
88 // Free
89 pool->Free(data, 5);
90 ASSERT_EQ(0, pool->bytes_allocated());
91 }
92
93 void TestAlignment() {
94 auto pool = memory_pool();

Callers 2

TYPED_TEST_PFunction · 0.80
TEST_FFunction · 0.80

Calls 5

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

Tested by

no test coverage detected