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.

How to distinguish below three kinds of heap ?

Other Parts Discussed in Thread: SYSBIOS

Hi,all:

I am confused by so many heaps if use sysbios/bios.

If I define below three kinds of heaps at the same time.what happen?

how to know which heap size is the real heap size ?

1. define heap in cmd file

xx.cmd file     - heap  0x4000

2.define heap in cfg file

BIOS.heapSize    = 0xB000;

3.define  heap in cfg file

var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
var heapMemParams = new HeapMem.Params();
heapMemParams.size = 0xC000;

 

 

  • Hi Ferdinand,

    The BIOS module creates a default heap (system heap) for use by SYS/BIOS. "BIOS.heapSize" is a BIOS module config param that allows you to control the size of this default heap. You should not use "-heap" in the linker cmd file when building a BIOS application. If you want to change the system heap size, you should use BIOS.heapSize to do so.


    Coming to question number 3 now. If you create your own heap instance like you showed above, it does not automatically become the system heap. If you want SYS/BIOS to use the heap instance you created as the system heap, you need to add something like this in your *.cfg file:

    Memory.defaultHeapInstance = Program.global.myHeap; // where myHeap points to the HeapMem instance

    I would recommend going through the "Dynamic Memory Allocation" section in the SYS/BIOS user guide (Section 6.7 in http://www.ti.com/lit/ug/spruex3m/spruex3m.pdf). It will cover everything I mentioned above and more in greater detail with examples.

    Best,

    Ashish