X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/165346ca29972817b1245e689315edeba1fe369b..8df3dcada5e34c6a99666931ee6dcccd57685353:/src/object.c diff --git a/src/object.c b/src/object.c index bba44824..b1eae963 100644 --- a/src/object.c +++ b/src/object.c @@ -245,8 +245,12 @@ robj *tryObjectEncoding(robj *o) { * range and if this is the main thread, since when VM is enabled we * have the constraint that I/O thread should only handle non-shared * objects, in order to avoid race conditions (we don't have per-object - * locking). */ - if (value >= 0 && value < REDIS_SHARED_INTEGERS && + * locking). + * + * Note that we also avoid using shared integers when maxmemory is used + * because very object needs to have a private LRU field for the LRU + * algorithm to work well. */ + if (server.maxmemory == 0 && value >= 0 && value < REDIS_SHARED_INTEGERS && pthread_equal(pthread_self(),server.mainthread)) { decrRefCount(o); incrRefCount(shared.integers[value]);