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

Ruby implement memsize functions for native types #10291

Closed
wants to merge 1 commit into from

Conversation

casperisfine
Copy link
Contributor

Fix: #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

ruby/ext/google/protobuf_c/map.c Show resolved Hide resolved
ruby/ext/google/protobuf_c/message.c Show resolved Hide resolved
ruby/ext/google/protobuf_c/protobuf.c Outdated Show resolved Hide resolved
@casperisfine
Copy link
Contributor Author

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

@haberman
Copy link
Member

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.

casperisfine pushed a commit to casperisfine/upb that referenced this pull request Aug 10, 2022
Ref: protocolbuffers/protobuf#10291

Ruby types defined though native extensions should register
a function that report their memory footprint in bytes.

This feature is used by various memory profiling tools.
casperisfine pushed a commit to casperisfine/upb that referenced this pull request Aug 10, 2022
Ref: protocolbuffers/protobuf#10291

Ruby types defined though native extensions should register
a function that report their memory footprint in bytes.

This feature is used by various memory profiling tools.
@casperisfine
Copy link
Contributor Author

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

Done! protocolbuffers/upb#729

casperisfine pushed a commit to casperisfine/upb that referenced this pull request Aug 10, 2022
Ref: protocolbuffers/protobuf#10291

Ruby types defined though native extensions should register
a function that report their memory footprint in bytes.

This feature is used by various memory profiling tools.
casperisfine pushed a commit to casperisfine/upb that referenced this pull request Aug 11, 2022
Ref: protocolbuffers/protobuf#10291

Ruby types defined though native extensions should register
a function that report their memory footprint in bytes.

This feature is used by various memory profiling tools.
casperisfine pushed a commit to casperisfine/upb that referenced this pull request Aug 11, 2022
Ref: protocolbuffers/protobuf#10291

Ruby types defined though native extensions should register
a function that report their memory footprint in bytes.

This feature is used by various memory profiling tools.
casperisfine pushed a commit to casperisfine/upb that referenced this pull request Aug 11, 2022
Ref: protocolbuffers/protobuf#10291

Ruby types defined though native extensions should register
a function that report their memory footprint in bytes.

This feature is used by various memory profiling tools.
casperisfine pushed a commit to casperisfine/upb that referenced this pull request Aug 16, 2022
Ref: protocolbuffers/protobuf#10291

Ruby types defined though native extensions should register
a function that report their memory footprint in bytes.

This feature is used by various memory profiling tools.
casperisfine pushed a commit to casperisfine/upb that referenced this pull request Sep 13, 2022
Ref: protocolbuffers/protobuf#10291

Ruby types defined though native extensions should register
a function that report their memory footprint in bytes.

This feature is used by various memory profiling tools.
casperisfine pushed a commit to casperisfine/upb that referenced this pull request Sep 13, 2022
Ref: protocolbuffers/protobuf#10291

Ruby types defined though native extensions should register
a function that report their memory footprint in bytes.

This feature is used by various memory profiling tools.
@haberman
Copy link
Member

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

@casperisfine
Copy link
Contributor Author

Rebeased.

@haberman haberman added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Feb 17, 2023
@github-actions github-actions bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Feb 17, 2023
@haberman
Copy link
Member

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

@casperisfine
Copy link
Contributor Author

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

Fix: protocolbuffers#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.
@casperisfine
Copy link
Contributor Author

Done.

@haberman haberman added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Feb 28, 2023
@github-actions github-actions bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Feb 28, 2023
@haberman
Copy link
Member

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.

Copy link

github-actions bot commented Jan 7, 2024

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 github-actions bot added the inactive Denotes the issue/PR has not seen activity in the last 90 days. label Jan 7, 2024
@github-actions github-actions bot removed the inactive Denotes the issue/PR has not seen activity in the last 90 days. label Jan 14, 2024
copybara-service bot pushed a commit that referenced this pull request Feb 13, 2024
Fix: #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

Closes #10291

COPYBARA_INTEGRATE_REVIEW=#10291 from casperisfine:ruby-sizes 9150795
FUTURE_COPYBARA_INTEGRATE_REVIEW=#10291 from casperisfine:ruby-sizes 9150795
PiperOrigin-RevId: 606424604
copybara-service bot pushed a commit that referenced this pull request Feb 13, 2024
Fix: #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

Closes #10291

COPYBARA_INTEGRATE_REVIEW=#10291 from casperisfine:ruby-sizes 9150795
FUTURE_COPYBARA_INTEGRATE_REVIEW=#10291 from casperisfine:ruby-sizes 9150795
PiperOrigin-RevId: 606424604
copybara-service bot pushed a commit that referenced this pull request Feb 13, 2024
Fix: #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

Closes #10291

COPYBARA_INTEGRATE_REVIEW=#10291 from casperisfine:ruby-sizes 9150795
FUTURE_COPYBARA_INTEGRATE_REVIEW=#10291 from casperisfine:ruby-sizes 9150795
PiperOrigin-RevId: 606424604
copybara-service bot pushed a commit that referenced this pull request Feb 13, 2024
Fix: #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

Closes #10291

COPYBARA_INTEGRATE_REVIEW=#10291 from casperisfine:ruby-sizes 9150795
FUTURE_COPYBARA_INTEGRATE_REVIEW=#10291 from casperisfine:ruby-sizes 9150795
PiperOrigin-RevId: 606424604
protobuf-team-bot added a commit that referenced this pull request Feb 13, 2024
zhangskz pushed a commit that referenced this pull request Feb 14, 2024
Fix: #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

Closes #10291

COPYBARA_INTEGRATE_REVIEW=#10291 from casperisfine:ruby-sizes 9150795
PiperOrigin-RevId: 606718632
zhangskz pushed a commit that referenced this pull request Feb 14, 2024
Fix: #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

Closes #10291

COPYBARA_INTEGRATE_REVIEW=#10291 from casperisfine:ruby-sizes 9150795
PiperOrigin-RevId: 606718632
zhangskz added a commit that referenced this pull request Feb 16, 2024
Ruby implement memsize functions for native types (#10291)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ruby: extension types should define a proper memsize function
6 participants