...sent the message too quickly.

So, the fix is trivial, yet it comes down to the same very discussion as 
the original issue. In this case it's cleaning up after the cleaners :) 
It's a global pointer that is initialized when global constructors 
(a.k.a. static initializers) run. The pointer to the heap block is never 
lost, but it is never deallocated either. The fix is trivial - all that 
is needed is the destructor. This, of course, assumes that the main 
thread would exit only after all additional workers are dead.

Oleg.

On 2009/5/15 17:28, Oleg Smolsky wrote:
> Actually, I got lucky - the culprit was not in headers. It's this line 
> in once.cc:
>
>     if (internal_ == NULL) internal_ = new GoogleOnceInternal;
>
> The log is as follows:
>
> Detected memory leaks!
> Dumping objects ->
> ..\src\google\protobuf\stubs\once.cc(65) : {1438} client block at 
> 0x00B92620, subtype 0, 24 bytes long.
>  Data: <h - > 68 A6 2D 00 FF FF FF FF 00 00 00 00 00 00 00 00
> ..\src\google\protobuf\stubs\once.cc(65) : {1437} client block at 
> 0x00B925C8, subtype 0, 24 bytes long.
>  Data: <0 - > 30 A6 2D 00 FF FF FF FF 00 00 00 00 00 00 00 00
> ..\src\google\protobuf\stubs\once.cc(65) : {946} client block at 
> 0x00246AB0, subtype 0, 24 bytes long.
>  Data: <  - > A0 A1 2D 00 FF FF FF FF 00 00 00 00 00 00 00 00
> ..\src\google\protobuf\stubs\once.cc(65) : {945} client block at 
> 0x00249CD0, subtype 0, 24 bytes long.
>  Data: <h - > 68 A1 2D 00 FF FF FF FF 00 00 00 00 00 00 00 00
> ..\src\google\protobuf\stubs\once.cc(65) : {934} client block at 
> 0x00249840, subtype 0, 24 bytes long.
>  Data: <0 - > 30 A1 2D 00 FF FF FF FF 00 00 00 00 00 00 00 00
> ..\src\google\protobuf\stubs\once.cc(65) : {812} client block at 
> 0x002469B0, subtype 0, 24 bytes long.
>  Data: <x - > 78 9D 2D 00 FF FF FF FF 00 00 00 00 00 00 00 00
> ..\src\google\protobuf\stubs\once.cc(73) : {685} client block at 
> 0x00B91FB0, subtype 0, 24 bytes long.
>  Data: <  - > D0 9C 2D 00 FF FF FF FF 00 00 00 00 00 00 00 00
> ..\src\google\protobuf\stubs\once.cc(73) : {667} client block at 
> 0x00B91608, subtype 0, 24 bytes long.
>  Data: <` - > 60 9C 2D 00 FF FF FF FF 00 00 00 00 00 00 00 00
> ..\src\google\protobuf\stubs\once.cc(65) : {666} client block at 
> 0x00B915B0, subtype 0, 24 bytes long.
>  Data: <( - > 28 9C 2D 00 FF FF FF FF 00 00 00 00 00 00 00 00
> ..\src\google\protobuf\stubs\once.cc(65) : {663} client block at 
> 0x00B913D8, subtype 0, 24 bytes long.
>  Data: <Pu- > 50 75 2D 00 FF FF FF FF 00 00 00 00 00 00 00 00
> ..\src\google\protobuf\stubs\once.cc(65) : {148} client block at 
> 0x00245820, subtype 0, 24 bytes long.
>  Data: <pt- > 70 74 2D 00 FF FF FF FF 00 00 00 00 00 00 00 00
> ..\src\google\protobuf\stubs\once.cc(65) : {147} client block at 
> 0x002457C8, subtype 0, 24 bytes long.
>  Data: <8t- > 38 74 2D 00 FF FF FF FF 00 00 00 00 00 00 00 00
> ..\src\google\protobuf\stubs\once.cc(65) : {136} client block at 
> 0x00245290, subtype 0, 24 bytes long.
>  Data: < t- > 00 74 2D 00 FF FF FF FF 00 00 00 00 00 00 00 00
> ..\src\google\protobuf\stubs\once.cc(65) : {135} client block at 
> 0x00245238, subtype 0, 24 bytes long.
>  Data: < s- > C8 73 2D 00 FF FF FF FF 00 00 00 00 00 00 00 00
> Object dump complete.
>


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

Reply via email to