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

Function pool_free

src/storage.cpp:100–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100void pool_free(struct alloc_pool *ppool, void *pv)
101{
102 struct object_page *cur = ppool->pobjpageHead;
103 char *obj = (char*)pv;
104
105 for (;cur != NULL;)
106 {
107 if (obj >= cur->rgb() && (obj < (cur->rgb() + (OBJECT_PAGE_BUFFER_SIZE * ppool->cbObject))))
108 {
109 // Its on this page
110 int idx = (obj - cur->rgb()) / ppool->cbObject;
111 cur->allocmap[idx / OBJ_PAGE_BITS_PER_WORD] &= ~(1ULL << (idx % OBJ_PAGE_BITS_PER_WORD));
112 return;
113 }
114 cur = cur->pnext;
115 }
116 serverLog(LL_WARNING, "obj not from pool");
117 sfree(obj); // we don't know where it came from
118 return;
119}
120
121extern size_t OBJ_ENCODING_EMBSTR_SIZE_LIMIT;
122#define EMBSTR_ROBJ_SIZE (sizeof(robj)+sizeof(struct sdshdr8)+OBJ_ENCODING_EMBSTR_SIZE_LIMIT+1)

Callers 3

sfree_objFunction · 0.85
sfree_objembstrFunction · 0.85
tbb_pool_freeFunction · 0.85

Calls 3

serverLogFunction · 0.85
rgbMethod · 0.80
sfreeFunction · 0.70

Tested by

no test coverage detected