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
| 1358 | * but to guarantee the performance of redis, we still allow dict to expand |
| 1359 | * if dict load factor exceeds HASHTABLE_MAX_LOAD_FACTOR. */ |
| 1360 | int 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. */ |
nothing calls this directly
no test coverage detected