MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / pool_alloc

Function pool_alloc

src/storage.cpp:80–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78 return -1;
79}
80void *pool_alloc(struct alloc_pool *ppool)
81{
82 struct object_page *cur = ppool->pobjpageHead;
83 for (;;)
84 {
85 int idx = IdxAllocObject(cur);
86 if (idx >= 0)
87 {
88 return cur->rgb() + (((size_t)ppool->cbObject) * idx);
89 }
90
91 if (cur->pnext == NULL)
92 {
93 cur->pnext = pool_allocate_page(ppool->cbObject);
94 }
95
96 cur = cur->pnext;
97 }
98}
99
100void pool_free(struct alloc_pool *ppool, void *pv)
101{

Callers 2

salloc_objFunction · 0.85
salloc_objembstrFunction · 0.85

Calls 3

IdxAllocObjectFunction · 0.85
pool_allocate_pageFunction · 0.85
rgbMethod · 0.80

Tested by

no test coverage detected