This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

about hung in heap_memory_free function

Other Parts Discussed in Thread: SYSBIOS

Hi all ,

I was use alloc and free function to implement dynamic memory management  .
But when I stress the code , the program is hung in sysbios api :HeapMem_free .
I have 2 questions .
1.Can I use alloc/ free to do dynamic memory management or need to use HeapMem_alloc/HeapMem_free
2.Can you provide some hint why the program is in follow while loop ?

sysbios version : bios_6_35_01_29

Here is the hang area 

    /* Go down freelist and find right place for buf */
    while (nextHeader != NULL && nextHeader < newHeader) {
        /* Make sure the addr is not in this free block */
        Assert_isTrue(((UArg)newHeader >= (UArg)nextHeader + nextHeader->size),
                       HeapMem_A_invalidFree);
        curHeader = nextHeader;
        nextHeader = nextHeader->next;
    }

  • Hi Brenden,

    1) Yes, the C Standard alloc/free functions can be used for dynamic memory management.
    2) With the provided data, I am not sure what may be causing the hang. Maybe the heap somehow got corrupted. Can you check the ROV views for HeapMem and BIOS Scan for Errors view? If you don't find any errors reported in ROV, can you share an example to recreate the issue on my computer?

    Vikram