Part Number:TMS320C6678
Tool/software: TI-RTOS
Hi,
I currently have a program that sends data over a messageQ from core0 to core1 for 100 iterations (to put it simply), however before the 100 iterations are up i run out of blocks in the heap created in the shared region as core0 is sending the messages quicker than core1 can receive the message and free the buffer, a solution i had thought of was to count how much of the heap had been allocated and to only send data when this was below a certain number. Currently i am trying to use the Memory_getStats() function for this and whilst i am getting usable outputs in another queue, the queue that i want to analyse always outputs that 0 memory has been allocated even when the program fails to complete the run due to a lack of heap blocks. Is there a reason it works in one queue and not the other? they both share the same heap space so it is not a wrong handle issue. Below is the function in which messages are sent to core1 with the Memory_getStats function included, i have also set HeapBufMP.trackAllocs = true in the config.
void send(char* name, float* data){ Task_sleep(1); //Open Queue created by other core, loop until found do { status = MessageQ_open(name, &QueueId[id]); if (status < 0){ Task_sleep(1); } }while (status < 0); //allocate message to heap msg = MessageQ_alloc(HEAPID, sizeof(myMsg)); if (msg == NULL){ System_abort("MessageQ_alloc failed\n"); } ((myMsg*)msg)->message = data[0]; //put message in messageQ status = MessageQ_put(QueueId[id], msg); xdc_runtime_Memory_Stats* stats; Memory_getStats((IHeap_Handle)heapHandle, stats); System_printf("max alloc %x\n", stats->totalSize); System_printf("alloc remaining %x\n", stats->totalFreeSize); id++; }