Looks like other folks faced similar issues with debug mode. https://github.com/protocolbuffers/protobuf/issues/6443
On Wednesday, May 17, 2023 at 11:25:26 PM UTC-7 Harsh Ranjan wrote: > The code is working fine in release mode but in debug mode it is > throwing Structured exception. Anyway by which we can enable same library > for both debug and release mode. > > On Wednesday, May 17, 2023 at 3:37:22 PM UTC-7 Harsh Ranjan wrote: > >> >> Is there a way I can debug on my local machine where protobufEventName >> is getting created? That is either stack/heap or arena? >> Based on the error it looks to me it is getting created in arena. >> at >> google::protobuf::Arena::CreateInternal<TelemetryProtobuf::EventNamespace> >> [x64\debug\telemetry_serializersink\x-none\x64\inc\google\protobuf\arena.h(527)] >> at >> google::protobuf::Arena::CreateMaybeMessage<TelemetryProtobuf::EventNamespace> >> >> [telemetry\serializersink\telemetryevent_v310.pb.cc(12052)] >> On Wednesday, May 17, 2023 at 3:32:52 PM UTC-7 Adam Cozzette wrote: >> >>> It's hard to know the answer to those questions without knowing how >>> protobufEventName >>> was created. If it was allocated on the stack then it will be automatically >>> destroyed once it goes out of scope, but if it was allocated on the heap >>> then you may need to explicitly delete it. If it was allocated on an arena >>> then you just have to make sure the arena gets destroyed eventually. >>> >>> On Wed, May 17, 2023 at 3:01 PM Harsh Ranjan <[email protected]> >>> wrote: >>> >>>> Do we need to explicitly destroy them? I am calling >>>> google::protobuf::ShutdownProtobufLibrary() >>>> at then end but this error pops up before this. Should I try to get rid of >>>> pointers and work with copy? >>>> >>>> On Wednesday, May 17, 2023 at 2:48:42 PM UTC-7 Adam Cozzette wrote: >>>> >>>>> The code you have posted looks fine as far as I can tell, so if there >>>>> is a memory leak then I think the problem is elsewhere. I suspect that >>>>> the >>>>> TelemetryProtobuf::EventName proto passed to PopulateEventName() is not >>>>> getting destroyed. Or if you're using an arena, then the arena that proto >>>>> was allocated on is not getting destroyed. >>>>> >>>>> On Wed, May 17, 2023 at 1:18 PM Harsh Ranjan <[email protected]> >>>>> wrote: >>>>> >>>>>> It is cpp code. I initially thought the issue is NULL pointers but >>>>>> then I replaced all the fields with hardcoded constant values and I >>>>>> still >>>>>> got the same issue. >>>>>> >>>>>> On Wednesday, May 17, 2023 at 12:41:37 PM UTC-7 Harsh Ranjan wrote: >>>>>> >>>>>>> Hey Team, >>>>>>> >>>>>>> I have been trying to add unit-test for my protobuf class. Attaching >>>>>>> the full error as pdf. >>>>>>> >>>>>>> [3 / 3] Leaked 72 bytes allocated at 000002E2A001AAC0 >>>>>>> at Mso::Memory::AllocateEx >>>>>>> [liblet\debugheap\memoryapiimpl\memoryapi.cpp(19)] >>>>>>> at Mso::Memory::Throw::AllocateEx >>>>>>> [x64\debug\liblet_operatornew\x-none\x64\inc\core\memoryApi_throw.h(29)] >>>>>>> at operator new >>>>>>> [x64\debug\liblet_precomp\x-none\x64\inc\core\memoryNew_Throw.h(61)] >>>>>>> at >>>>>>> google::protobuf::Arena::CreateInternal<TelemetryProtobuf::EventNamespace> >>>>>>> >>>>>>> [x64\debug\telemetry_serializersink\x-none\x64\inc\google\protobuf\arena.h(527)] >>>>>>> at >>>>>>> google::protobuf::Arena::CreateMaybeMessage<TelemetryProtobuf::EventNamespace> >>>>>>> >>>>>>> [telemetry\serializersink\telemetryevent_v310.pb.cc(12052)] >>>>>>> at >>>>>>> google::protobuf::MessageLite::CreateMaybeMessage<TelemetryProtobuf::EventNamespace> >>>>>>> >>>>>>> [x64\debug\telemetry_serializersink\x-none\x64\inc\google\protobuf\message_lite.h(449)] >>>>>>> >>>>>>> I am just populating the protobuf event. >>>>>>> void PopulateEventNameSpace(TelemetryProtobuf::EventNamespace& >>>>>>> protobufEventNamespace, const Telemetry::TelemetryNamespace& >>>>>>> telemetryNamespace) noexcept >>>>>>> { >>>>>>> protobufEventNamespace.set_fullnamelength(8); >>>>>>> protobufEventNamespace.set_nodenamecount(1010); >>>>>>> } >>>>>>> >>>>>>> void PopulateEventName(TelemetryProtobuf::EventName& >>>>>>> protobufEventName, const Telemetry::EventName& telemetryEventName) >>>>>>> noexcept >>>>>>> { >>>>>>> protobufEventName.set_eventnodename("baz"); >>>>>>> PopulateEventNameSpace(*protobufEventName.mutable_eventnamespace(), >>>>>>> telemetryEventName.GetNamespace()); >>>>>>> } >>>>>>> >>>>>>> Anything I am missing here? I am using the protobuf version 3.10 >>>>>>> >>>>>>> Thanks, >>>>>>> Harsh >>>>>>> >>>>>> -- >>>>>> 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 [email protected]. >>>>>> To view this discussion on the web visit >>>>>> https://groups.google.com/d/msgid/protobuf/45432e0a-50e0-48de-8811-50024981d805n%40googlegroups.com >>>>>> >>>>>> <https://groups.google.com/d/msgid/protobuf/45432e0a-50e0-48de-8811-50024981d805n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>> . >>>>>> >>>>> -- >>>> 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 [email protected]. >>>> >>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/protobuf/521a5ca8-66ac-42a2-a414-62159f16f306n%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/protobuf/521a5ca8-66ac-42a2-a414-62159f16f306n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/a62488bb-b66a-44c9-a825-59a6d1cc056cn%40googlegroups.com.
