Re: zero_copy_stream_unittest.cc doesn't compile with msvc 7.1/2003

2009-07-06 Thread Kenton Varda
What's the _MSC_VER for that version?
On Mon, Jul 6, 2009 at 10:37 AM, Cosmin Cremarenco <
cosmin.cremare...@gmail.com> wrote:

>
> It is Visual Studio 2003 - Version 7.1.6030.
> I think the .1 minor comes from the installation of sp1 over 7.0
>
> Cosmin
>
> On Jul 6, 7:33 pm, Kenton Varda  wrote:
> > This is with MSVC 7.1?  Which version of Visual Studio does that
> correspond
> > to?  I can never keep these straight.
> >
> > On Mon, Jul 6, 2009 at 7:27 AM, Cosmin Cremarenco <
> >
> >
> >
> > cosmin.cremare...@gmail.com> wrote:
> >
> > > Hi
> >
> > > When compiling zero_copy_stream_unittest.cc from the last version
> > > 2.1.0 msvc complains about the
> > > type "_invalid_parameter_handler" (I don't think it is supported in
> > > 7.1):
> > > Compiling...
> > > zero_copy_stream_unittest.cc
> > > \tmp\protobuf-2.1.0-vc71\src\google\protobuf\io
> > > \zero_copy_stream_unittest.cc(475) : error C2146: syntax error :
> > > missing ';' before identifier 'old_handler_'
> > > \tmp\protobuf-2.1.0-vc71\src\google\protobuf\io
> > > \zero_copy_stream_unittest.cc(475) : error C2501:
> > > 'google::protobuf::io::`anonymous-
> > > namespace'::MsvcDebugDisabler::_invalid_parameter_handler' : missing
> > > storage-class or type specifiers
> > > \tmp\protobuf-2.1.0-vc71\src\google\protobuf\io
> > > \zero_copy_stream_unittest.cc(475) : error C2501:
> > > 'google::protobuf::io::`anonymous-
> > > namespace'::MsvcDebugDisabler::old_handler_' : missing storage-class
> > > or type specifiers
> >
> > > Changing the wrapping conditional compilation macro from "#if
> > > _MSC_VER" to "#if 0" fixes it.
> >
> > > Best regards,
> >
> > > Cosmin
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



RE: GoogleOnceType showing up as a memory leak

2009-07-06 Thread Alex Black
Thanks.



From: Kenton Varda [mailto:ken...@google.com] 
Sent: Monday, July 06, 2009 1:32 PM
To: Alex Black
Cc: Protocol Buffers
Subject: Re: GoogleOnceType showing up as a memory leak


Yes, this is a known bug resulting from the fact that I developed the
shutdown code on Linux rather than Windows -- this bug only exists on
Windows.  It's still not a real leak unless you are dynamically loading
and unloading the protobuf library as a DLL.  In any case, this has been
fixed in SVN and the fix will be in the next release.


On Mon, Jul 6, 2009 at 9:05 AM, Alex Black  wrote:



I'm using a memory leak detection tool (ms crtdbg).  It runs at
the
end of the program (after main has exited), and is reporting 7
40byte
leaks, each of which corresponds to a new call in
GoogleOnceType,
they're each one of these two:

GoogleOnceType::GoogleOnceType() {
 // internal_ may be non-NULL if Init() was already called.
 if (internal_ == NULL) internal_ = new

void GoogleOnceType::Init(void (*init_func)()) {
 // internal_ may be NULL if we're still in dynamic
initialization
and the
 // constructor has not been called yet.  As mentioned in
once.h, we
assume
 // that the program is still single-threaded at this time, and
therefore it
 // should be safe to initialize internal_ like so.
 if (internal_ == NULL) internal_ = new GoogleOnceInternal;

 EnterCriticalSection(&internal_->critical_section);
 if (!initialized_) {
   init_func();
   initialized_ = true;
 }
 LeaveCriticalSection(&internal_->critical_section);
}

I *am* calling google::protobuf::ShutdownProtobufLibrary(); at
the end
of my Main routine (i.e. before the memory leak detection is
done).

Are these real leaks? Is there any way I can avoid seeing them
as
leaks (it'd be nice to have 0 leaks... :)

- Alex






--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Parser fails silently if first numeric field has value zero.

2009-07-06 Thread Kenton Varda
This is most likely a bug in your code -- you probably aren't transmitting
the message correctly.  Please make sure that the bytes you give to the
protobuf parser on the receiving end are exactly the same bytes that were
produced by the serializer at the sending end -- both the size and contents
must be identical.  If you are still having problems, please write a small
example program demonstrating the issue and send it to me to debug.
On Sun, Jul 5, 2009 at 11:30 PM, Vijay Mathew
wrote:

>
> Hello all,
>
> I have a Message type EventStatus with the following definition:
>
> message EventStatus {
> required int32 reason = 1;
> required string msg = 2;
> }
>
> This is part of a larger protocol where a C++ client sends an event to
> a Java server where it is handled. The Java server returns an
> EventStatus. If the reason field is 0 (success), protobuf parser on C+
> + side does not read the value of the msg field. If the reason field
> is > 0, then it works fine. As a workaround I reversed the order of
> the two fields:
>
> message EventStatus {
> required string msg = 1;
> required int32 reason = 2;
> }
>
> Now the msg field is read even when reason is zero.
>
> Why this strange behavior? Is this a known bug is protobuf?
>
> Thanks,
>
> -- Vijay
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: zero_copy_stream_unittest.cc doesn't compile with msvc 7.1/2003

2009-07-06 Thread Cosmin Cremarenco

It is Visual Studio 2003 - Version 7.1.6030.
I think the .1 minor comes from the installation of sp1 over 7.0

Cosmin

On Jul 6, 7:33 pm, Kenton Varda  wrote:
> This is with MSVC 7.1?  Which version of Visual Studio does that correspond
> to?  I can never keep these straight.
>
> On Mon, Jul 6, 2009 at 7:27 AM, Cosmin Cremarenco <
>
>
>
> cosmin.cremare...@gmail.com> wrote:
>
> > Hi
>
> > When compiling zero_copy_stream_unittest.cc from the last version
> > 2.1.0 msvc complains about the
> > type "_invalid_parameter_handler" (I don't think it is supported in
> > 7.1):
> > Compiling...
> > zero_copy_stream_unittest.cc
> > \tmp\protobuf-2.1.0-vc71\src\google\protobuf\io
> > \zero_copy_stream_unittest.cc(475) : error C2146: syntax error :
> > missing ';' before identifier 'old_handler_'
> > \tmp\protobuf-2.1.0-vc71\src\google\protobuf\io
> > \zero_copy_stream_unittest.cc(475) : error C2501:
> > 'google::protobuf::io::`anonymous-
> > namespace'::MsvcDebugDisabler::_invalid_parameter_handler' : missing
> > storage-class or type specifiers
> > \tmp\protobuf-2.1.0-vc71\src\google\protobuf\io
> > \zero_copy_stream_unittest.cc(475) : error C2501:
> > 'google::protobuf::io::`anonymous-
> > namespace'::MsvcDebugDisabler::old_handler_' : missing storage-class
> > or type specifiers
>
> > Changing the wrapping conditional compilation macro from "#if
> > _MSC_VER" to "#if 0" fixes it.
>
> > Best regards,
>
> > Cosmin
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: zero_copy_stream_unittest.cc doesn't compile with msvc 7.1/2003

2009-07-06 Thread Kenton Varda
This is with MSVC 7.1?  Which version of Visual Studio does that correspond
to?  I can never keep these straight.

On Mon, Jul 6, 2009 at 7:27 AM, Cosmin Cremarenco <
cosmin.cremare...@gmail.com> wrote:

>
> Hi
>
> When compiling zero_copy_stream_unittest.cc from the last version
> 2.1.0 msvc complains about the
> type "_invalid_parameter_handler" (I don't think it is supported in
> 7.1):
> Compiling...
> zero_copy_stream_unittest.cc
> \tmp\protobuf-2.1.0-vc71\src\google\protobuf\io
> \zero_copy_stream_unittest.cc(475) : error C2146: syntax error :
> missing ';' before identifier 'old_handler_'
> \tmp\protobuf-2.1.0-vc71\src\google\protobuf\io
> \zero_copy_stream_unittest.cc(475) : error C2501:
> 'google::protobuf::io::`anonymous-
> namespace'::MsvcDebugDisabler::_invalid_parameter_handler' : missing
> storage-class or type specifiers
> \tmp\protobuf-2.1.0-vc71\src\google\protobuf\io
> \zero_copy_stream_unittest.cc(475) : error C2501:
> 'google::protobuf::io::`anonymous-
> namespace'::MsvcDebugDisabler::old_handler_' : missing storage-class
> or type specifiers
>
> Changing the wrapping conditional compilation macro from "#if
> _MSC_VER" to "#if 0" fixes it.
>
> Best regards,
>
> Cosmin
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: GoogleOnceType showing up as a memory leak

2009-07-06 Thread Kenton Varda
Yes, this is a known bug resulting from the fact that I developed the
shutdown code on Linux rather than Windows -- this bug only exists on
Windows.  It's still not a real leak unless you are dynamically loading and
unloading the protobuf library as a DLL.  In any case, this has been fixed
in SVN and the fix will be in the next release.

On Mon, Jul 6, 2009 at 9:05 AM, Alex Black  wrote:

>
> I'm using a memory leak detection tool (ms crtdbg).  It runs at the
> end of the program (after main has exited), and is reporting 7 40byte
> leaks, each of which corresponds to a new call in GoogleOnceType,
> they're each one of these two:
>
> GoogleOnceType::GoogleOnceType() {
>  // internal_ may be non-NULL if Init() was already called.
>  if (internal_ == NULL) internal_ = new
>
> void GoogleOnceType::Init(void (*init_func)()) {
>  // internal_ may be NULL if we're still in dynamic initialization
> and the
>  // constructor has not been called yet.  As mentioned in once.h, we
> assume
>  // that the program is still single-threaded at this time, and
> therefore it
>  // should be safe to initialize internal_ like so.
>  if (internal_ == NULL) internal_ = new GoogleOnceInternal;
>
>  EnterCriticalSection(&internal_->critical_section);
>  if (!initialized_) {
>init_func();
>initialized_ = true;
>  }
>  LeaveCriticalSection(&internal_->critical_section);
> }
>
> I *am* calling google::protobuf::ShutdownProtobufLibrary(); at the end
> of my Main routine (i.e. before the memory leak detection is done).
>
> Are these real leaks? Is there any way I can avoid seeing them as
> leaks (it'd be nice to have 0 leaks... :)
>
> - Alex
>
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



GoogleOnceType showing up as a memory leak

2009-07-06 Thread Alex Black

I'm using a memory leak detection tool (ms crtdbg).  It runs at the
end of the program (after main has exited), and is reporting 7 40byte
leaks, each of which corresponds to a new call in GoogleOnceType,
they're each one of these two:

GoogleOnceType::GoogleOnceType() {
  // internal_ may be non-NULL if Init() was already called.
  if (internal_ == NULL) internal_ = new

void GoogleOnceType::Init(void (*init_func)()) {
  // internal_ may be NULL if we're still in dynamic initialization
and the
  // constructor has not been called yet.  As mentioned in once.h, we
assume
  // that the program is still single-threaded at this time, and
therefore it
  // should be safe to initialize internal_ like so.
  if (internal_ == NULL) internal_ = new GoogleOnceInternal;

  EnterCriticalSection(&internal_->critical_section);
  if (!initialized_) {
init_func();
initialized_ = true;
  }
  LeaveCriticalSection(&internal_->critical_section);
}

I *am* calling google::protobuf::ShutdownProtobufLibrary(); at the end
of my Main routine (i.e. before the memory leak detection is done).

Are these real leaks? Is there any way I can avoid seeing them as
leaks (it'd be nice to have 0 leaks... :)

- Alex

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



zero_copy_stream_unittest.cc doesn't compile with msvc 7.1/2003

2009-07-06 Thread Cosmin Cremarenco

Hi

When compiling zero_copy_stream_unittest.cc from the last version
2.1.0 msvc complains about the
type "_invalid_parameter_handler" (I don't think it is supported in
7.1):
Compiling...
zero_copy_stream_unittest.cc
\tmp\protobuf-2.1.0-vc71\src\google\protobuf\io
\zero_copy_stream_unittest.cc(475) : error C2146: syntax error :
missing ';' before identifier 'old_handler_'
\tmp\protobuf-2.1.0-vc71\src\google\protobuf\io
\zero_copy_stream_unittest.cc(475) : error C2501:
'google::protobuf::io::`anonymous-
namespace'::MsvcDebugDisabler::_invalid_parameter_handler' : missing
storage-class or type specifiers
\tmp\protobuf-2.1.0-vc71\src\google\protobuf\io
\zero_copy_stream_unittest.cc(475) : error C2501:
'google::protobuf::io::`anonymous-
namespace'::MsvcDebugDisabler::old_handler_' : missing storage-class
or type specifiers

Changing the wrapping conditional compilation macro from "#if
_MSC_VER" to "#if 0" fixes it.

Best regards,

Cosmin
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---