Permalink
Browse files

touch less pages in decrRefCount

  • Loading branch information...
1 parent 82c6e9c commit 112569d12d64612289138424785443045a217972 antirez committed Jun 2, 2011
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/object.c
View
@@ -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--;
}
}

0 comments on commit 112569d

Please sign in to comment.