MCPcopy Create free account
hub / github.com/apache/brpc / AllocAndDealloc

Function AllocAndDealloc

test/brpc_block_pool_unittest.cpp:92–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92static void* AllocAndDealloc(void* arg) {
93 uintptr_t i = (uintptr_t)arg;
94 int len = GetBlockSize(i % 3);
95 int iterations = 1000;
96 while (iterations > 0) {
97 void* buf = AllocBlock(len);
98 EXPECT_TRUE(buf != NULL);
99 EXPECT_EQ(i % 3, GetBlockType(buf));
100 DeallocBlock(buf);
101 --iterations;
102 }
103 return NULL;
104}
105
106TEST_F(BlockPoolTest, multiple_thread) {
107 FLAGS_rdma_memory_pool_initial_size_mb = 1024;

Callers

nothing calls this directly

Calls 4

GetBlockSizeFunction · 0.85
AllocBlockFunction · 0.85
GetBlockTypeFunction · 0.85
DeallocBlockFunction · 0.85

Tested by

no test coverage detected