-
Notifications
You must be signed in to change notification settings - Fork 8
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 each instance #3
Comments
Thanks for the suggestion! The difficulty of trying to implement this within the library is that there is no standard, cross-platform way to determine the size of the header that In the meantime, I can tell you that the memory usage of each container is as follows:
The memory usage of an initialized but not yet used container is effectively zero because |
Wow! Thanks for the quick and detailed reply. For the purposes of Ruby's runtime, a best effort seems to be enough here. So I'll use your formulas and ignore the header and padding for now. I'm sure this will be fine. Thanks again. |
Q: should, say, |
Oops! Sorry. You're right — all those container header structs should be suffixed with |
Thanks so much for this fascinating code!
I am suggesting a function that looks like this:
It would return the amount of (heap) memory associated with cntr.
Use case: when I am writing extension code for Ruby in C, the Ruby runtime likes to know how much memory is associated with a given object (although it doesn't insist on this knowledge). This helps with profiling and (I suspect) the Ruby garbage collector.
The text was updated successfully, but these errors were encountered: