Unverified Commit f899c31f authored by Salvatore Sanfilippo's avatar Salvatore Sanfilippo Committed by GitHub
Browse files

Merge pull request #6261 from chendq8/robj

make memory usage consistent of robj with OBJ_ENCODING_INT
parents fc5c2052 004c26ec
...@@ -467,10 +467,15 @@ robj *tryObjectEncoding(robj *o) { ...@@ -467,10 +467,15 @@ robj *tryObjectEncoding(robj *o) {
incrRefCount(shared.integers[value]); incrRefCount(shared.integers[value]);
return shared.integers[value]; return shared.integers[value];
} else { } else {
if (o->encoding == OBJ_ENCODING_RAW) sdsfree(o->ptr); if (o->encoding == OBJ_ENCODING_RAW) {
o->encoding = OBJ_ENCODING_INT; sdsfree(o->ptr);
o->ptr = (void*) value; o->encoding = OBJ_ENCODING_INT;
return o; o->ptr = (void*) value;
return o;
} else {
decrRefCount(o);
return createStringObjectFromLongLongForValue(value);
}
} }
} }
......
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