From fe1c096b1849b633f41f69f432c4236428035950 Mon Sep 17 00:00:00 2001 From: guybe7 Date: Sun, 17 Apr 2022 07:31:57 +0200 Subject: Add RM_MallocSizeString, RM_MallocSizeDict (#10542) Add APIs to allow modules to compute the memory consumption of opaque objects owned by redis. Without these, the mem_usage callbacks of module data types are useless in many cases. Other changes: Fix streamRadixTreeMemoryUsage to include the size of the rax structure itself --- src/object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/object.c') diff --git a/src/object.c b/src/object.c index a60a27e90..093e2619e 100644 --- a/src/object.c +++ b/src/object.c @@ -958,7 +958,7 @@ char *strEncoding(int encoding) { * on the insertion speed and thus the ability of the radix tree * to compress prefixes. */ size_t streamRadixTreeMemoryUsage(rax *rax) { - size_t size; + size_t size = sizeof(*rax); size = rax->numele * sizeof(streamID); size += rax->numnodes * sizeof(raxNode); /* Add a fixed overhead due to the aux data pointer, children, ... */ -- cgit v1.2.1