Skip to content

Conversation

heavyk
Copy link

@heavyk heavyk commented Jul 15, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant