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

Function zfree

src/zmalloc.cpp:295–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

293#endif
294
295void zfree(const void *ptr) {
296#ifndef HAVE_MALLOC_SIZE
297 void *realptr;
298 size_t oldsize;
299#endif
300
301 if (ptr == NULL) return;
302#ifdef HAVE_MALLOC_SIZE
303 update_zmalloc_stat_free(zmalloc_size((void*)ptr));
304 free((void*)ptr);
305#else
306 realptr = (char*)ptr-PREFIX_SIZE;
307 oldsize = *((size_t*)realptr);
308 update_zmalloc_stat_free(oldsize+PREFIX_SIZE);
309 free(realptr);
310#endif
311}
312
313/* Similar to zfree, '*usable' is set to the usable size being freed. */
314void zfree_usable(void *ptr, size_t *usable) {

Callers 15

stressGetKeysFunction · 0.85
discardDbBackupFunction · 0.85
restoreDbBackupFunction · 0.85
getKeysFreeResultFunction · 0.85
slotToKeyUpdateKeyCoreFunction · 0.85
lwFreeCanvasFunction · 0.85
listEmptyFunction · 0.85
listReleaseFunction · 0.85
listDelNodeFunction · 0.85
listReleaseIteratorFunction · 0.85
bulkInsertMethod · 0.85
asyncFreeDictTableFunction · 0.85

Calls 2

zmalloc_sizeFunction · 0.85
freeFunction · 0.85

Tested by

no test coverage detected