On Thu, Nov 9, 2017 at 11:53 AM, Arpit Baldeva wrote:
> Hi,
>
> Currently, protobuf generated code makes allocations in the static
> descriptor objects. For example, valgrind reports
>
>
>Memcheck:Leak
>fun:malloc
>fun:_ZN20PassthroughAllocator5AllocEmPKcj
>fun:_Znwm
>fun:_ZN6google8protobuf14DescriptorPoolC1EPNS0_
> 18DescriptorDatabaseEPNS1_14ErrorCollectorE
>fun:_ZN6google8protobuf12_GLOBAL__N_1L17InitGeneratedPoolEv
>fun:_ZN6google8protobuf8internal16FunctionClosure03RunEv
>fun:_ZN6google8protobuf18GoogleOnceInitImplEPlPNS0_7ClosureE
>fun:_ZN6google8protobuf14GoogleOnceInitEPlPFvvE
>fun:_ZN6google8protobuf12_GLOBAL__N_121InitGeneratedPoolOnceEv
>fun:_ZN6google8protobuf14DescriptorPool24InternalAddGeneratedFileEPKvi
>fun:_ZN5Blaze51protobuf_blaze_2fprotobuf_2fblazeextensions_2eproto12_
> GLOBAL__N_118AddDescriptorsImplEv
>fun:_ZN6google8protobuf8internal16FunctionClosure03RunEv
>fun:_ZN6google8protobuf18GoogleOnceInitImplEPlPNS0_7ClosureE
>fun:_ZN6google8protobuf14GoogleOnceInitEPlPFvvE
>fun:_ZN5Blaze51protobuf_blaze_2fprotobuf_2fblazeextensions_
> 2eproto14AddDescriptorsEv
>fun:_ZN5Blaze51protobuf_blaze_2fprotobuf_2fblazeextensions_
> 2eproto27StaticDescriptorInitializerC1Ev
>fun:_Z41__static_initialization_and_destruction_0ii
>fun:_GLOBAL__sub_I_blazeextensions.pb.cc
>
> Is there a convenience function that could deallocate these objects so
> that I don't have to suppress these allocations? Found this relevant issue
> - https://codereview.appspot.com/7918 - 9 years ago.
>
You can call ShutdownProtobufLibrary() before program exiting and after
that there should be no such "leaks".
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.