diff options
author | antirez <antirez@gmail.com> | 2018-01-15 12:50:08 +0100 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2018-01-15 12:50:08 +0100 |
commit | c45366be0a08e6777b63150198ddfe9119be9132 (patch) | |
tree | 871c83e3013d6b4121d6718c8643406833acbe76 /src | |
parent | 1ed5ac7ce5322b3c57c1637574b9e87e1af7b76d (diff) | |
download | redis-c45366be0a08e6777b63150198ddfe9119be9132.tar.gz |
Put more details in the comment introduced by #4601.
Diffstat (limited to 'src')
-rw-r--r-- | src/lazyfree.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/lazyfree.c b/src/lazyfree.c index cfab6a31a..f1de0c898 100644 --- a/src/lazyfree.c +++ b/src/lazyfree.c @@ -64,9 +64,14 @@ int dbAsyncDelete(redisDb *db, robj *key) { robj *val = dictGetVal(de); size_t free_effort = lazyfreeGetFreeEffort(val); - /* If releasing the object is too much work and the refcount - * is 1, that means the object really needs to be freed, - * let's put it into the lazy free list. */ + /* If releasing the object is too much work, do it in the background + * by adding the object to the lazy free list. + * Note that if the object is shared, to reclaim it now it is not + * possible. This rarely happens, however sometimes the implementation + * of parts of the Redis core may call incrRefCount() to protect + * objects, and then call dbDelete(). In this case we'll fall + * through and reach the dictFreeUnlinkedEntry() call, that will be + * equivalent to just calling decrRefCount(). */ if (free_effort > LAZYFREE_THRESHOLD && val->refcount == 1) { atomicIncr(lazyfree_objects,1); bioCreateBackgroundJob(BIO_LAZY_FREE,val,NULL,NULL); |