Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory Usage for Debugging #57

Open
fredfortier opened this issue Jul 16, 2021 · 4 comments
Open

Memory Usage for Debugging #57

fredfortier opened this issue Jul 16, 2021 · 4 comments

Comments

@fredfortier
Copy link

fredfortier commented Jul 16, 2021

What is a good way to get the current memory usage of a rpds structure? I'm looking for something like Servo's malloc_size_of. I can get the size of leaves but I'm missing the size of branches. Or is it trivial to calculate it? Any recommendation would be appreciated.

@orium
Copy link
Owner

orium commented Jul 19, 2021

Hi @fredfortier. There's no simple way to get those numbers. I can imagine a custom allocator that keeps track of which functions allocate memory.

If you want to go a bit more intrusive and modify rpds you can traverse the tree of the data structure you want to inspect and sum all sizes together.

Keep in mind that most persistent data structures keep a fair amount of extra data, so I expect the memory overhead to be significant for most data structures.

@fredfortier
Copy link
Author

Any simple formula I can use to compute an estimated size? I don't need precise measurements. If I can make some assumptions, like treat them all as uncolored binary search tree, while remaining in the ballpark, it might be good enough for me.

@orium
Copy link
Owner

orium commented Jul 19, 2021

Which particular data structure are you trying to get the memory usage of?

@fredfortier
Copy link
Author

These here: HashTrieMapSync, HashTrieSetSync, RedBlackTreeMapSync, RedBlackTreeSetSync, StackSync

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

No branches or pull requests

2 participants