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

Function incrRefCount

src/object.cpp:392–403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

390}
391
392void incrRefCount(robj_roptr o) {
393 auto refcount = o->getrefcount(std::memory_order_relaxed);
394 if (refcount < OBJ_FIRST_SPECIAL_REFCOUNT) {
395 o->addref();
396 } else {
397 if (refcount == OBJ_SHARED_REFCOUNT) {
398 /* Nothing to do: this refcount is immutable. */
399 } else if (refcount == OBJ_STATIC_REFCOUNT) {
400 serverPanic("You tried to retain an object allocated in the stack");
401 }
402 }
403}
404
405void decrRefCount(robj_roptr o) {
406 if (o->getrefcount(std::memory_order_relaxed) == OBJ_SHARED_REFCOUNT)

Callers 15

genericSetKeyFunction · 0.85
renameGenericCommandFunction · 0.85
moveCommandFunction · 0.85
propagateExpireFunction · 0.85
pubsubSubscribeChannelFunction · 0.85
pubsubUnsubscribeChannelFunction · 0.85
pubsubSubscribePatternFunction · 0.85
pubsubUnsubscribePatternFunction · 0.85
migrateCommandFunction · 0.85
queueMultiCommandFunction · 0.85
watchForKeyFunction · 0.85
performEvictionsFunction · 0.85

Calls 2

getrefcountMethod · 0.80
addrefMethod · 0.80

Tested by

no test coverage detected