protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

Ruby implement memsize functions for native types

Open casperisfine opened this issue 3 years ago • 3 comments

Fix: https://github.com/protocolbuffers/protobuf/issues/10280

This allows Ruby to report a more correct estimation of the memory used by these objects.

It's useful when running memory profilers against applications.

cc @zhangskz @haberman

casperisfine avatar Jul 21 '22 06:07 casperisfine

@haberman thanks. I updated Arena_memsize according to your suggestions.

casperisfine avatar Aug 03 '22 08:08 casperisfine

Thanks for the changes. Would you be able to submit the ruby-upb.c/.h changes to https://github.com/protocolbuffers/upb/blob/main/upb/arena.h and https://github.com/protocolbuffers/upb/blob/main/upb/arena.c, which is that code's primary location.

We can create a new function upb_Arena_SpaceAllocated() that is then called from here.

haberman avatar Aug 10 '22 00:08 haberman

. Would you be able to submit the ruby-upb.c/.h changes to ...

Done! https://github.com/protocolbuffers/upb/pull/729

casperisfine avatar Aug 10 '22 08:08 casperisfine

If you rebase on main it should pick up the upb_Arena_SpaceAllocated() function that is there now.

haberman avatar Feb 16 '23 22:02 haberman

Rebeased.

casperisfine avatar Feb 17 '23 07:02 casperisfine

I think we need one more rebase here (I think this conflicted with your other change).

haberman avatar Feb 27 '23 23:02 haberman

Oh wow, I had forgotten about this one. I'll rebase.

casperisfine avatar Feb 28 '23 07:02 casperisfine

Done.

casperisfine avatar Feb 28 '23 07:02 casperisfine

The Ruby 2.6 test failed with:

ruby/ext/google/protobuf_c/protobuf.c:417: void ObjectCache_Add(const void *, VALUE): Assertion `ObjectCache_Get(key) == val' failed. Aborted (core dumped)

It's hard to see how this PR would have caused that error. I'll try re-running that test.

haberman avatar Feb 28 '23 17:02 haberman

We triage inactive PRs and issues in order to make it easier to find active work. If this PR should remain active, please add a comment.

This PR is labeled inactive because the last activity was over 90 days ago. This PR will be closed and archived after 14 additional days without activity.

github-actions[bot] avatar Jan 07 '24 10:01 github-actions[bot]