MCPcopy Create free account
hub / github.com/F-Stack/f-stack / lpShrinkToFit

Function lpShrinkToFit

app/redis-6.2.6/src/listpack.c:243–250  ·  view source on GitHub ↗

Shrink the memory to fit. */

Source from the content-addressed store, hash-verified

241
242/* Shrink the memory to fit. */
243unsigned char* lpShrinkToFit(unsigned char *lp) {
244 size_t size = lpGetTotalBytes(lp);
245 if (size < lp_malloc_size(lp)) {
246 return lp_realloc(lp, size);
247 } else {
248 return lp;
249 }
250}
251
252/* Given an element 'ele' of size 'size', determine if the element can be
253 * represented inside the listpack encoded as integer, and returns

Callers 1

streamAppendItemFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected