MCPcopy Create free account
hub / github.com/F-Stack/f-stack / streamRadixTreeMemoryUsage

Function streamRadixTreeMemoryUsage

app/redis-6.2.6/src/object.c:794–801  ·  view source on GitHub ↗

This is an helper function with the goal of estimating the memory * size of a radix tree that is used to store Stream IDs. * * Note: to guess the size of the radix tree is not trivial, so we * approximate it considering 16 bytes of data overhead for each * key (the ID), and then adding the number of bare nodes, plus some * overhead due by the data and child pointers. This secret recipe * wa

Source from the content-addressed store, hash-verified

792 * on the insertion speed and thus the ability of the radix tree
793 * to compress prefixes. */
794size_t streamRadixTreeMemoryUsage(rax *rax) {
795 size_t size;
796 size = rax->numele * sizeof(streamID);
797 size += rax->numnodes * sizeof(raxNode);
798 /* Add a fixed overhead due to the aux data pointer, children, ... */
799 size += rax->numnodes * sizeof(long)*30;
800 return size;
801}
802
803/* Returns the size in bytes consumed by the key's value in RAM.
804 * Note that the returned value is just an approximation, especially in the

Callers 1

objectComputeSizeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected