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

Function dictExpandAllowed

app/redis-6.2.6/src/server.c:1360–1366  ·  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

1358 * but to guarantee the performance of redis, we still allow dict to expand
1359 * if dict load factor exceeds HASHTABLE_MAX_LOAD_FACTOR. */
1360int dictExpandAllowed(size_t moreMem, double usedRatio) {
1361 if (usedRatio <= HASHTABLE_MAX_LOAD_FACTOR) {
1362 return !overMaxmemoryAfterAlloc(moreMem);
1363 } else {
1364 return 1;
1365 }
1366}
1367
1368/* Generic hash table type where keys are Redis Objects, Values
1369 * dummy pointers. */

Callers

nothing calls this directly

Calls 1

overMaxmemoryAfterAllocFunction · 0.85

Tested by

no test coverage detected