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

Function dictTypeExpandAllowed

src/dict.cpp:1340–1345  ·  view source on GitHub ↗

Because we may need to allocate huge memory chunk at once when dict * expands, we will check this allocation is allowed or not if the dict * type has expandAllowed member function. */

Source from the content-addressed store, hash-verified

1338 * expands, we will check this allocation is allowed or not if the dict
1339 * type has expandAllowed member function. */
1340static int dictTypeExpandAllowed(dict *d) {
1341 if (d->type->expandAllowed == NULL) return 1;
1342 return d->type->expandAllowed(
1343 _dictNextPower(d->ht[0].used + 1) * sizeof(dictEntry*),
1344 (double)d->ht[0].used / d->ht[0].size);
1345}
1346
1347/* Expand the hash table if needed */
1348static int _dictExpandIfNeeded(dict *d)

Callers 1

_dictExpandIfNeededFunction · 0.85

Calls 1

_dictNextPowerFunction · 0.70

Tested by

no test coverage detected