mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 17:10:50 +00:00
Merge pull request #4601 from soloestoy/fix-memoryleak-for-lazy-server-del
lazyfree: fix memory leak for lazyfree-lazy-server-del
This commit is contained in:
commit
1ed5ac7ce5
@ -64,9 +64,10 @@ int dbAsyncDelete(redisDb *db, robj *key) {
|
|||||||
robj *val = dictGetVal(de);
|
robj *val = dictGetVal(de);
|
||||||
size_t free_effort = lazyfreeGetFreeEffort(val);
|
size_t free_effort = lazyfreeGetFreeEffort(val);
|
||||||
|
|
||||||
/* If releasing the object is too much work, let's put it into the
|
/* If releasing the object is too much work and the refcount
|
||||||
* lazy free list. */
|
* is 1, that means the object really needs to be freed,
|
||||||
if (free_effort > LAZYFREE_THRESHOLD) {
|
* let's put it into the lazy free list. */
|
||||||
|
if (free_effort > LAZYFREE_THRESHOLD && val->refcount == 1) {
|
||||||
atomicIncr(lazyfree_objects,1);
|
atomicIncr(lazyfree_objects,1);
|
||||||
bioCreateBackgroundJob(BIO_LAZY_FREE,val,NULL,NULL);
|
bioCreateBackgroundJob(BIO_LAZY_FREE,val,NULL,NULL);
|
||||||
dictSetVal(db->dict,de,NULL);
|
dictSetVal(db->dict,de,NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user