1
0
mirror of https://github.com/fluencelabs/redis synced 2025-06-13 01:01:22 +00:00

optimize reply list memory usage

This commit is contained in:
zhaozhao.zz
2018-06-13 20:35:40 +08:00
parent 032ea657d7
commit 963002d71e

@ -247,7 +247,7 @@ void _addReplyStringToList(client *c, const char *s, size_t len) {
/* Append to this object when possible. If tail == NULL it was /* Append to this object when possible. If tail == NULL it was
* set via addDeferredMultiBulkLength(). */ * set via addDeferredMultiBulkLength(). */
if (tail && sdslen(tail)+len <= PROTO_REPLY_CHUNK_BYTES) { if (tail && (sdsavail(tail) >= len || sdslen(tail)+len <= PROTO_REPLY_CHUNK_BYTES)) {
tail = sdscatlen(tail,s,len); tail = sdscatlen(tail,s,len);
listNodeValue(ln) = tail; listNodeValue(ln) = tail;
c->reply_bytes += len; c->reply_bytes += len;