Quick question: I am a C# guy debugging a C++ app so I am not used to memory management.
In the following code:
for(int i = 0; i < TlmMsgDB.CMTGetTelemMsgDBCount(); i++)
{
CMTTelemetryMsgCls* telm = TlmMsgDB.CMTGetTelemetryMsg(i);
CMT_SINT32_Tdef id = telm->CMTGetPackingMapID();
ManualScheduleTables.SetManualMsg(i,id);
ManualScheduleTables.SetManExec(i,false);
}
Am I leaking memory every iteration b/c of CMTTelemetryMsgCls* telm = TlmMsgDB.CMTGetTelemetryMsg(i);? The “CMTGetTelemetryMsg(int)” method returns a pointer.
Do I have to “delete telm;” at the end of each iteration?
There is no global answer for this question.
It really depends on how the person implemented the function with the return value.
You need to look on the implementation of the function you’re calling:
TlmMsgDB.CMTGetTelemetryMsg