-
Notifications
You must be signed in to change notification settings - Fork 15.5k
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
InitializeDefaultRepeatedFields() allocates memory but does not release ... #43
Conversation
@@ -1622,6 +1622,9 @@ struct StaticDefaultRepeatedFieldsInitializer { | |||
StaticDefaultRepeatedFieldsInitializer() { | |||
InitializeDefaultRepeatedFields(); | |||
} | |||
~StaticDefaultRepeatedFieldsInitializer() { | |||
DestroyDefaultRepeatedFields(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you register this function with google::protobuf::internal::OnShutdown() instead? ShutdownProtobufLibrary() wil call these callbacks and release all memory allocated by protobuf runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done :)
Please sign this Google CLA: Thanks. |
Signed. |
Release objects allocated by InitializeDefaultRepeatedFields()
Add flag to MessageDef for whether fields have presence.
Add flag to MessageDef for whether fields have presence.
Using protobuf-2.6.0 and current master results in C++ example leakage in src/google/protobuf/extension_set.cc line 1632 and further.
This problem reproduces with current protobuf example:
Sample output:
It would be nice to have protobuf not leaving this memory unallocated to make good old memory sanitizer happy :).
One of the solutions would be creating destructor for StaticDefaultRepeatedFieldsInitializer which would clean everything. Another solution could be using unique pointers.