rax icon indicating copy to clipboard operation
rax copied to clipboard

Heap size

Open heavyk opened this issue 5 years ago • 0 comments

I was implementing the memory usage function of a redis module data type that used RM_CreateDict. RM_DictSize just returns the numele, and I needed the actual bytes for the memory usage. nothing like it exists in the code, so I implemented it. it may be useful to export the function to redis modules so they can report the dictionary memory size if a custom type uses it (my use case exactly).

the function is quite simple, combining the raxTouch function, summing raxNodeCurrentLength on every node. it should be working properly. I thought about doing a redefinition of malloc/realloc which stores the length before the pointer as shown here, but I'm pretty sure the implementation is correct.

thanks, kenny

heavyk avatar Jul 15 '19 16:07 heavyk