summaryrefslogtreecommitdiff
path: root/src/networking.c
diff options
context:
space:
mode:
authorHarkrishn Patro <harkrisp@amazon.com>2022-07-03 23:18:57 -0700
committerGitHub <noreply@github.com>2022-07-04 09:18:57 +0300
commit0ab885a685101522017021ac2d2b46b42d268f26 (patch)
treef86373af640b61d9040b8ef9a6bb75f06dd3efd3 /src/networking.c
parent679344a2b064735b1807ccd70ef318a5829a277b (diff)
downloadredis-0ab885a685101522017021ac2d2b46b42d268f26.tar.gz
Account sharded pubsub channels memory consumption (#10925)
Account sharded pubsub channels memory consumption in client memory usage computation to accurately evict client based on the set threshold for `maxmemory-clients`.
Diffstat (limited to 'src/networking.c')
-rw-r--r--src/networking.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/networking.c b/src/networking.c
index 7d94c4808..e8a93dde3 100644
--- a/src/networking.c
+++ b/src/networking.c
@@ -3669,9 +3669,7 @@ size_t getClientMemoryUsage(client *c, size_t *output_buffer_mem_usage) {
/* Add memory overhead of pubsub channels and patterns. Note: this is just the overhead of the robj pointers
* to the strings themselves because they aren't stored per client. */
- mem += listLength(c->pubsub_patterns) * sizeof(listNode);
- mem += dictSize(c->pubsub_channels) * sizeof(dictEntry) +
- dictSlots(c->pubsub_channels) * sizeof(dictEntry*);
+ mem += pubsubMemOverhead(c);
/* Add memory overhead of the tracking prefixes, this is an underestimation so we don't need to traverse the entire rax */
if (c->client_tracking_prefixes)