diff options
author | antirez <antirez@metal.(none)> | 2011-06-02 17:41:42 +0200 |
---|---|---|
committer | antirez <antirez@metal.(none)> | 2011-06-02 17:41:42 +0200 |
commit | 112569d12d64612289138424785443045a217972 (patch) | |
tree | d824ed853c095082dc4ef7f30b5b14f0f9ab6137 /src | |
parent | 82c6e9c29727ec8488981168e12aa016d7dcdf54 (diff) | |
download | redis-112569d12d64612289138424785443045a217972.tar.gz |
touch less pages in decrRefCount
Diffstat (limited to 'src')
-rw-r--r-- | src/object.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/object.c b/src/object.c index e521e5dab..88398eac1 100644 --- a/src/object.c +++ b/src/object.c @@ -203,7 +203,7 @@ void decrRefCount(void *obj) { * assert will fail. */ if (server.vm_enabled && o->storage == REDIS_VM_SWAPPING) vmCancelThreadedIOJob(o); - if (--(o->refcount) == 0) { + if (o->refcount == 1) { switch(o->type) { case REDIS_STRING: freeStringObject(o); break; case REDIS_LIST: freeListObject(o); break; @@ -212,8 +212,9 @@ void decrRefCount(void *obj) { case REDIS_HASH: freeHashObject(o); break; default: redisPanic("Unknown object type"); break; } - o->ptr = NULL; /* defensive programming. We'll see NULL in traces. */ zfree(o); + } else { + o->refcount--; } } |