Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 184 by h.a.syed: C++ Strange Memory Warning Under Visual Studio 2008 SP1 on Windows 7

What steps will reproduce the problem?

1. Compile a protobuf object in an application under a visual studio debug
2. Call "SerializeAsString()" on a protobuf class.
3. This may cause a memory leak warning in "AppendPartialToString" after
"string_as_array" function has returned.

What is the expected output? What do you see instead?

Visual studio crashed with a buffer under-run message. The stack frame
which was fine before the call is now filled with garbage. Strangely
though, the problem dissapears when a "Release" build is tried.

My code is part of a portable project, so I tried debug and normal builds
under Linux. I also ran valgrind on the binary and no leaks were reported.
I am assuming this has something to do with a combination of the debug STL
library provided by microsoft and the suspicious looking callto "stl_util-
inl.h:85". The code is accessing the underlying string buffer via the
following snippet "return s5tr->empty() ? NULL : &*str->begin();".

I hope you can reproduce the issue. I am hoping the Release build is indeed
free of errors.

You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:

You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to