Descriptionprotobuf - fix memory leak of statically initialized generated descriptor objects (C++)
The reflection_ and default_instance_ objects allocated in the
BuildDescriptors functions at static initialization time are not destructed
prior to process teardown. This causes memory leak checkers (such as the
one in MSVC) to complain.
This change fixes the issue by making protoc also generate a destructor that
deletes these objects.
(Only the message objects actually have anything to destruct, but I've added
placeholders for enums and services to help encourage cleanup of these if
required in the future.)
See http://code.google.com/p/protobuf/issues/detail?id=54
Tested with MSVC 8.0. All tests pass.
Patch Set 1 #
MessagesTotal messages: 1
|