Skip to content

Fix mem leak in composable bridging#1199

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_931161831
Open

Fix mem leak in composable bridging#1199
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_931161831

Conversation

@copybara-service

Copy link
Copy Markdown

Fix mem leak in composable bridging

Previously, it was possible for composable bridging to cause a mem leak because of internal implementation details. In particular, it sometimes std::moved values in and out of intermediate type-erased buffers, and didn't call the destructor on the moved from slots. This was particularly a problem for types whose move constructors actually just perform a copy, which is valid C++ because destructors are supposed to be called on all values, including moved-from values.

This change fixes this by adding a deferred call to the destructor so it always gets called on the type erased slot.

Previously, it was possible for composable bridging to cause a mem leak because of internal implementation details. In particular, it sometimes `std::move`d values in and out of intermediate type-erased buffers, and didn't call the destructor on the moved from slots. This was particularly a problem for types whose move constructors actually just perform a copy, which is valid C++ because destructors are supposed to be called on all values, including moved-from values.

This change fixes this by adding a deferred call to the destructor so it always gets called on the type erased slot.

PiperOrigin-RevId: 931161831
@google-cla

google-cla Bot commented Jun 12, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants