memory_profiler
memory_profiler copied to clipboard
Include breakdown of shared strings in objects allocated
I've been using memory_profiler to profile a few optimizations around string allocations and usage of byteslice vs string mutation, and although the number of strings allocated has increased, I suspect that the majority is shared. Unfortunately, there's no way to tell just based on the breakdown charts.
Are the current breakdowns already taking that into account, and if not, would it be an interesting addition?
I am open to adding this. Optional opt-in feature, would you like to work on a PR?
I could try. Could you point me to where the class/string accounting is performed?
@HoneyryderChuck Are you still interested in implementing this?
@SamSaffron Looks like determining if a string is shared can be done only from C. Are you ok in adding a little bit of C code to this gem?
@fatkodima I guess since we are MRI only it seems possibly reasonable. Kind of prefer that there is a helper gem we optionally lean on, cause installing C extensions always brings up edge cases and this is the only piece we need now.
@fatkodima here's the (closed) MR: https://github.com/SamSaffron/memory_profiler/pull/99 . I'm not actively trying to solve it anymore, so feel free to.