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 <harshranjan...@gmail.com>
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 protobuf+unsubscr...@googlegroups.com.
> 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 protobuf+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/CADqAXr4-LNXztqmYL6jF16%2BUgXcJNvp2P0BKzZMPNPNQsn5zAw%40mail.gmail.com.

Reply via email to