diff --git a/src/object.c b/src/object.c index 1380fffa5..1b8852f18 100644 --- a/src/object.c +++ b/src/object.c @@ -787,7 +787,7 @@ size_t objectComputeSize(robj *o, size_t sample_size) { if(o->encoding == OBJ_ENCODING_INT) { asize = sizeof(*o); } else if(o->encoding == OBJ_ENCODING_RAW) { - asize = sdsAllocSize(o->ptr)+sizeof(*o); + asize = sdsZmallocSize(o->ptr)+sizeof(*o); } else if(o->encoding == OBJ_ENCODING_EMBSTR) { asize = sdslen(o->ptr)+2+sizeof(*o); } else { @@ -815,7 +815,7 @@ size_t objectComputeSize(robj *o, size_t sample_size) { asize = sizeof(*o)+sizeof(dict)+(sizeof(struct dictEntry*)*dictSlots(d)); while((de = dictNext(di)) != NULL && samples < sample_size) { ele = dictGetKey(de); - elesize += sizeof(struct dictEntry) + sdsAllocSize(ele); + elesize += sizeof(struct dictEntry) + sdsZmallocSize(ele); samples++; } dictReleaseIterator(di); @@ -837,7 +837,7 @@ size_t objectComputeSize(robj *o, size_t sample_size) { (sizeof(struct dictEntry*)*dictSlots(d))+ zmalloc_size(zsl->header); while(znode != NULL && samples < sample_size) { - elesize += sdsAllocSize(znode->ele); + elesize += sdsZmallocSize(znode->ele); elesize += sizeof(struct dictEntry) + zmalloc_size(znode); samples++; znode = znode->level[0].forward; @@ -856,7 +856,7 @@ size_t objectComputeSize(robj *o, size_t sample_size) { while((de = dictNext(di)) != NULL && samples < sample_size) { ele = dictGetKey(de); ele2 = dictGetVal(de); - elesize += sdsAllocSize(ele) + sdsAllocSize(ele2); + elesize += sdsZmallocSize(ele) + sdsZmallocSize(ele2); elesize += sizeof(struct dictEntry); samples++; } @@ -996,7 +996,7 @@ struct redisMemOverhead *getMemoryOverheadData(void) { mem = 0; if (server.aof_state != AOF_OFF) { - mem += sdsalloc(server.aof_buf); + mem += sdsZmallocSize(server.aof_buf); mem += aofRewriteBufferSize(); } mh->aof_buffer = mem; @@ -1312,7 +1312,7 @@ NULL return; } size_t usage = objectComputeSize(dictGetVal(de),samples); - usage += sdsAllocSize(dictGetKey(de)); + usage += sdsZmallocSize(dictGetKey(de)); usage += sizeof(dictEntry); addReplyLongLong(c,usage); } else if (!strcasecmp(c->argv[1]->ptr,"stats") && c->argc == 2) { diff --git a/src/server.c b/src/server.c index 956cad587..2f7aa8713 100644 --- a/src/server.c +++ b/src/server.c @@ -1626,7 +1626,7 @@ int clientsCronTrackClientsMemUsage(client *c) { size_t mem = 0; int type = getClientType(c); mem += getClientOutputBufferMemoryUsage(c); - mem += sdsAllocSize(c->querybuf); + mem += sdsZmallocSize(c->querybuf); mem += sizeof(client); /* Now that we have the memory used by the client, remove the old * value from the old category, and add it back. */