How to fix the Redis OOM command not allowed error
This means Redis has hit its memory limit and the current eviction policy will not free space, so it rejects writes. Changing the policy or freeing memory resolves it. Jump to your situation below or work through the methods in order.
By Neeraj Singh ~7 min Updated Jun 2026 88% found this helpful
Error message
OOM command not allowed when used memory > 'maxmemory'.
Summary
The Redis OOM command not allowed when used memory > 'maxmemory' error means Redis has reached its configured memory limit and the active eviction policy will not free space, so it refuses any command that would use more memory. The default policy noeviction returns this error on writes once the limit is hit. The fix is to choose how Redis should behave when full: set a sensible eviction policy such as allkeys-lru so it evicts the least-recently-used keys automatically, raise maxmemory or add RAM if the dataset genuinely needs more room, and free memory by deleting unused keys or setting expirations. Investigating what is consuming memory (large keys, no TTLs) prevents it recurring. Once Redis can either evict or has headroom, writes succeed again.
What this error means
Redis keeps everything in memory and enforces a maxmemory ceiling. When usage reaches that ceiling, what happens next depends on the eviction policy. With the default noeviction, Redis protects your data by refusing writes rather than dropping keys, which surfaces as the OOM error.
So the error is really a policy decision, not a crash. Either you let Redis evict old data automatically by choosing an eviction policy, or you give it more room with a higher maxmemory or more RAM, or you reduce what is stored. Which path fits depends on whether the data is a cache (evict freely) or a store of record (add room).
Common causes
Memory usage reached maxmemory.
The eviction policy is noeviction.
The dataset outgrew the allocated memory.
Keys have no expirations and accumulate.
A few very large keys are consuming memory.
Expert insight
“OOM is Redis hitting its memory ceiling and, under the default noeviction policy, refusing to drop your data, so it refuses the write instead. The first question I ask is what is this Redis, a cache or a store? If it is a cache, set allkeys-lru and let it evict old keys automatically. If it is a store of record, you give it more room with a higher maxmemory or more RAM. And either way I hunt down the big keys and the keys with no TTL, because that is usually what filled it.”
Manager, Tech Support & Operations · 19+ years fixing Windows and system errors
✓ How to fix it
Method 1
Set an eviction policy
1For a cache, let Redis evict automatically:
CONFIG SET maxmemory-policy allkeys-lru
2Persist it in redis.conf so it survives restarts.
3Other options include allkeys-lfu and volatile-lru for keys with a TTL.
Method 2
Raise maxmemory or add RAM
1If the data genuinely needs more room, raise the limit:
CONFIG SET maxmemory 4gb
2Make sure the host actually has that RAM, and update redis.conf.
3Scale the instance up if needed.
Method 3
Free memory and set expirations
1Delete unused keys and add TTLs so data expires:
EXPIRE mykey 3600
2This stops keys accumulating forever.
3Memory usage drops and writes resume.
Method 4
Find what is using memory
1Inspect memory and large keys:
INFO memory
redis-cli --bigkeys
2Target the biggest consumers first.
3Use MEMORY USAGE on suspects.
OOM is Redis at its memory limit with noeviction refusing writes. For a cache, set maxmemory-policy to allkeys-lru so it evicts automatically. For a store of record, raise maxmemory or add RAM. Either way, find the big keys and add TTLs so memory does not fill up again.
Frequently asked questions
What does the Redis OOM error mean?
It means Redis reached its maxmemory limit and the eviction policy (by default noeviction) will not free space, so it refuses commands that would use more memory, such as writes.
How do I fix it?
Set an eviction policy like allkeys-lru so Redis evicts old keys, raise maxmemory or add RAM if the data needs more room, and free memory by deleting unused keys or adding expirations.
What eviction policy should I use?
For a cache, allkeys-lru or allkeys-lfu evicts the least-used keys across the whole keyspace. For a store where only some keys are disposable, volatile-lru evicts only keys that have a TTL.
Why does noeviction reject writes?
noeviction protects your data by refusing to drop keys when memory is full. Instead of evicting, it returns the OOM error on writes, leaving reads working. Choose another policy to allow eviction.
How do I find what is using memory?
Run INFO memory for an overview and redis-cli --bigkeys to find the largest keys, then MEMORY USAGE <key> on suspects. Large keys and keys without TTLs are common causes.
Will adding RAM alone fix it?
It buys headroom, but if the dataset keeps growing without eviction or TTLs it will fill again. Combine more memory with an eviction policy or expirations for a lasting fix.
Still not working?
If memory stays full even after eviction, check for a large replication backlog, AOF rewrite buffers, or client output buffers in INFO memory, since those consume memory outside your keys and can keep Redis at the ceiling. You can also submit your error to us for a tailored fix.