Status: New
Owner: liuj...@google.com
Labels: Type-Defect Priority-Medium
New issue 444 by mjkl...@gmail.com: ShutdownProtobufLibrary() have to be
called from each binaries, not only once.
http://code.google.com/p/protobuf/issues/detail?id=444
I'm using Visual Studio 2012 Update 1.
I also use VLD to check memory leaks (which is far more helpful than the VS
basic memory leak feature).
Assuming you have an application with several binaries, memory leaks occurs
if ShutdownProtobufLibrary() is not called from code in each of the
binaries using protobuf (in static lib), not only from the main executable.
Let's say I have
- Foo : an executable using protobuf statically linked;
- Bar : a DLL using protobuf statically linked;
- Foo is linking Bar at compilation.
- Both Foo and Bar use protoc generated source code and libprotobuf
serialization functions.
Then I observe that:
- If ShutdownProtobufLibrary() is called only at the end of main() in
Foor, VLD will report memory leaks from protobuf.
- If ShutdownProtobufLibrary() is called only somewhere in Bar (making
sure it's called after use but before the end of main()), then I also have
VLD reporting memory leaks from protobuf.
- If I have both Foo calling ShutdownProtobufLibrary() and Bar calling it
once not used but before Foo's call, then VLD report no memory leaks.
There should be a way to have a clean shutdown from only one point (at the
end of the main() function). Maybe through another more general function?
--
You received this message because you are subscribed to the Google Groups "Protocol
Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/protobuf?hl=en.