I have a strange situation in my program. I have a Task and inside this task I am trying to dynamically create an big object.
UPP = new OMAPL138UPPDriver();
Where UPP is the pointer. Inside its constructor there is following code:
OutCircleBufferA = NULL; // pointer
OutCircleBufferB = NULL; // pointer
UPPDriverHeap = NULL; // HeapMem_Handle
ISRHandle = NULL; // Hwi_Handle
CurrentOutPacketA = NULL; // pointer
CurrentOutPacketB = NULL; // pointer
SynchronizationEvent = NULL; // Event_Handle
WaitForAsyncTransferEventA = NULL; // Event_Handle
WaitForAsyncTransferEventB = NULL; // Event_Handle
ProcessingTaskHandle = NULL; //Task_Handle
OutBufferFirstElementIndexA = 0;
OutBufferLastElementIndexA = 0;
OutBufferFirstElementIndexB = 0;
OutBufferLastElementIndexB = 0;
InBufferSizeA = 0;
InBufferSizeB = 0;
InBufferCurrentIndexA = 0;
InBufferCurrentIndexB = 0;
OutBufferCurrentIndexA = 0;
OutBufferCurrentIndexB = 0;
InPacketNoBlockA = 0;
InPacketNoBlockB = 0;
IDLastPacketSentA = 0;
IDLastPacketSentB = 0;
OutPacketCounterA = 1;
OutPacketCounterB = 1;
InPacketCounterA = 1;
InPacketCounterB = 1;
SystemInitialized = false;
BufferInitialized = false;
OutBufferFullA = false;
OutBufferEmptyA = true;
OutBufferFullB = false;
OutBufferEmptyB = true;
TransmissionActiveA = false;
TransmissionActiveB = false;
BlockingAsyncReceivingA = false;
BlockingAsyncReceivingB = false;
ChannelEnabledA = true;
ChannelEnabledB = true;
InputWindowAddressA = NULL; // pointer
InputWindowAddressB = NULL; // pointer
So its only initializing class members. When I am debugging it after passing line 'WaitForAsyncTransferEventA = NULL;' the HeapMem totalFreeSize parameter seen in the ROV window becomes 0. When I checked which instruction is making it in disassembly code it turned out that after following instruction the totalFreeSize parameter resets: 'STR R0, [R12, #0x104]'. The R0 is 0 and the R12 is 0xC30098A8. The HeapMem address seen in ROV is 0xC30FF5AC. How it is possible?