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

Function dictExpandAllowed

src/server.cpp:1454–1460  ·  view source on GitHub ↗

Return 1 if currently we allow dict to expand. Dict may allocate huge * memory to contain hash buckets when dict expands, that may lead redis * rejects user's requests or evicts some keys, we can stop dict to expand * provisionally if used memory will be over maxmemory after dict expands, * but to guarantee the performance of redis, we still allow dict to expand * if dict load factor exceeds

Source from the content-addressed store, hash-verified

1452 * but to guarantee the performance of redis, we still allow dict to expand
1453 * if dict load factor exceeds HASHTABLE_MAX_LOAD_FACTOR. */
1454int dictExpandAllowed(size_t moreMem, double usedRatio) {
1455 if (usedRatio <= HASHTABLE_MAX_LOAD_FACTOR) {
1456 return !overMaxmemoryAfterAlloc(moreMem);
1457 } else {
1458 return 1;
1459 }
1460}
1461
1462void dictGCAsyncFree(dictAsyncRehashCtl *async);
1463

Callers

nothing calls this directly

Calls 1

overMaxmemoryAfterAllocFunction · 0.85

Tested by

no test coverage detected