Commit 112569d1 authored by antirez's avatar antirez
Browse files

touch less pages in decrRefCount

parent 82c6e9c2
...@@ -203,7 +203,7 @@ void decrRefCount(void *obj) { ...@@ -203,7 +203,7 @@ void decrRefCount(void *obj) {
* assert will fail. */ * assert will fail. */
if (server.vm_enabled && o->storage == REDIS_VM_SWAPPING) if (server.vm_enabled && o->storage == REDIS_VM_SWAPPING)
vmCancelThreadedIOJob(o); vmCancelThreadedIOJob(o);
if (--(o->refcount) == 0) { if (o->refcount == 1) {
switch(o->type) { switch(o->type) {
case REDIS_STRING: freeStringObject(o); break; case REDIS_STRING: freeStringObject(o); break;
case REDIS_LIST: freeListObject(o); break; case REDIS_LIST: freeListObject(o); break;
...@@ -212,8 +212,9 @@ void decrRefCount(void *obj) { ...@@ -212,8 +212,9 @@ void decrRefCount(void *obj) {
case REDIS_HASH: freeHashObject(o); break; case REDIS_HASH: freeHashObject(o); break;
default: redisPanic("Unknown object type"); break; default: redisPanic("Unknown object type"); break;
} }
o->ptr = NULL; /* defensive programming. We'll see NULL in traces. */
zfree(o); zfree(o);
} else {
o->refcount--;
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment