Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include specific kind of VM-internal T_IMEMO object in allocation info
**What does this PR do?** This PR extends the code that generates a description for an object during allocation to include the specific kind of `T_IMEMO` object. On Ruby < 3, the `rb_imemo_name` function we're relying on does not exist, so I chose to just not gather this information for legacy Rubies. (It's posssible to still get it, but I didn't want to spend more time). **Motivation:** During discussion of DataDog#3282 the question of what a `T_IMEMO` is came up, and since it turns out it can represent different kinds of things in the Ruby VM, I decided to see if there was a way of spelling those out, and it turns out there is. Is this going to be useful for most customers? Probably not, but even for our internal debugging/learning, it may come in handy, so it was a bit of a "why not" kinda thing. **Additional Notes:** N/A **How to test the change?** I hesitated in terms of testing this, since these objects are internally created by the VM so we could only run a bit of code and kinda hope to trigger their creation. Since this was a kind-of small thing I... decided to just leave it as-is without a specific test. In the future, we may add some testing, if we think this feature is useful enough. I did test it locally -- on Ruby 3.x I got from this trivial script `DD_PROFILING_ENABLED=true bundle exec ddtracerb exec ruby -e "def foo; end; foo; sleep(1)"` (output from `go pprof tool`): ``` allocation class:[(VM Internal, T_IMEMO, callcache)] ruby vm type:[T_IMEMO] thread id:[649074 (2660)] thread name:[main] allocation class:[(VM Internal, T_IMEMO, constcache)] ruby vm type:[T_IMEMO] thread id:[649074 (2660)] thread name:[main] allocation class:[(VM Internal, T_IMEMO, ment)] ruby vm type:[T_IMEMO] thread id:[649074 (2660)] thread name:[main] ``` whereas on Ruby 2.x, I got the `(VM Internal, T_IMEMO)` only.
- Loading branch information