# MEMORY PURGE

> Ask the server to give memory it has freed back to the operating system.

URL: https://docs.hotkv.com/commands/memory-purge/

```
MEMORY PURGE
```

- Group: Server
- HotKV Cloud: all plans
- On-Premise: no license needed

After many keys are deleted, expire or are evicted, the server process can
keep holding memory it no longer uses, which shows as `used_memory_rss`
well above `used_memory` in [INFO](https://docs.hotkv.com/commands/info/index.md). `MEMORY PURGE` asks the
process to return such memory to the operating system. Whether and how much
is returned depends on the platform and build; on some it has no effect.

It does not delete or move any data. [FLUSHDB](https://docs.hotkv.com/commands/flushdb/index.md) and
[FLUSHALL](https://docs.hotkv.com/commands/flushall/index.md) already do this when they finish, so you do
not need `MEMORY PURGE` after them.

## Return value

Simple string `OK` in RESP2 and RESP3.

## Examples

```
127.0.0.1:6379> MEMORY PURGE
OK
```

## Compatibility

Same as Redis 7 and Valkey 8.

## See also

[MEMORY DOCTOR](https://docs.hotkv.com/commands/memory-doctor/index.md), [MEMORY STATS](https://docs.hotkv.com/commands/memory-stats/index.md)