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.

Heap size vs. segment size

Other Parts Discussed in Thread: OMAP3530, SYSBIOS

Greetings,

I'm using the OMAP3530 with DSPLink 1.64 (via Openembedded Linux running on the ARM core) and DSP/BIOS 5.41.02.14.  I noticed recently that some of my MEM_calloc calls were failing.  Inspection of the MEM_stat output showed that the 'size' attribute was tracking the heap size defined in my TCI file as DDR2.heapSize, rather than the segment size defined as DDR2.len.  I have plenty of memory, so I merely increased the heapSize to exceed all requested memory and got the allocations to work.  However, I imagine something is wrong since memory should be allocated from the segment outside the heap; my understanding was that only the allocation entries are placed in the heap. Is this a bug or a misunderstanding on my part?

Thanks
Michael

 

  • MEM_stat allows you to see how much of your heap has been used, not how much of your total memory.  For that you should look at the map file generated by the linker.

  • Thanks Brad.  I think I misunderstood what the name "heap" means.  I originally thought the "heap" was the data structure used for keeping track of dynamically allocated memory, rather than the actual dynamically allocated memory regions.  Based on the latter definition, it makes sense that the heap size needs to accommodate all dynamically allocated memory segments and can range from 0 to the segment size.  Is it correct that the heap is the only dynamic memory in the segment, and all other memory needs should be arranged statically by the compiler/linker?

    Michael

     

  • Yes.   In BIOS 5.x, there is only 1 heap allowed per segment.  The rest is managed by the linker.  Or with hard addresses in your app which is not a good idea!

    BTW, in BIOS 6.x, you can have multiple heaps in a single segment.  This is useful since we have different types of heaps (buffer pools vs traditional variable sized heaps).

    -Karl-

  • Hi,

     

    I had question on similar lines,

     

    I am running a simulation scenario which is throwing out of heap error.

    xdc.runtime.Memory: line 52: out of memory: heap=0x8d49dc, size=102456

    so, in my project cfg file, i tried to increase the heap size, from 1024 to 2048 ,and each time, i get the same error

    xdc.runtime.Memory: line 52: out of memory: heap=0x8d49dc, size=102456

     

    Also in  the cfg file i tried to load different elements ( i mean, .text etc) into DDR2 rather than MSMCRAM and tried out, but the error message i get is the same, my expectation was the size should have reduced in the error message as i am making more room .So i am doubtful whether the changes i am making are taking effect?

     

    Btw this is on Nyquist sim and Bios 6.x.

     

    Is there any other exclusive way i can allocate more heap space/

     

    Thanks,

    Kishore.

  • Hi Kishore,

    The error message

    xdc.runtime.Memory: line 52: out of memory: heap=0x8d49dc, size=102456

    is telling you (the error message is not clear at all) that there has been a request for a block of size = 102456.

    Please set the heap size to > 102456 and try again.

    Regards,

    Nitya

     

  • Hi Nitya,

     

    Thanks for the reply.

     

    I set the heap size to  heapMemParams.size =  0x3000000 ; ( as given in another thread) and this is greater than 102456).

     

    But this causes problems in other sections of memory ( Linker error)

     run placement fails for object ".far", size 0x3026fad (page 0).  Available
       ranges:
       L2RAM        size: 0x100000     unused: 0xdf1fa      max hole: 0xdf1bc  

    And .far is configured as Program.sectMap[".far"] = "L2RAM";

     

    Thanks,

    Kishore.


  • You've run out of internal memory.  You need to place either your heap or your .far section in external memory.

  • Kishore --

    You might want to read the updated memory chapter (Chapter 5 of the BIOS 6.30 User's Guide -- http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/bios/sysbios/6_30_02_42/exports/docs/docs/Bios_User_Guide.pdf).

    See below code sample.  You probably want to put that big heap in external DDR memory.  You can leave .far in SL2 if that's what you want.  Something like the following should work.  You will need to rename the DDR to DDR2 or whatever your platform has.  

    The last line has a typo.  I already told tech writer.  It should say:

    Memory.defaultHeapInstance = Program.global.systemHeap;

     

  • hi,

     

    Well  actually, it has turned out that the L2 ram is the one which is running out of memory as Brad pointed out. There is sufficient MSMC space.

    Right now i am trying to provide 102456 amount of space in L2 somehow.

    Having said that, i managed to get 0x9000 by mapping .const from L2 to DDR2.

    i tried mapping .far from L2 to DDR/MSMC , but the program needs it to be in L2, it seems.

     

    Now i was thinking is i can selectively move some .obj elements in this far section to DDR ? If so where should be doing it ..in the cfg file?

    something like this

    SECTION

    {

       .farDDR  load = DDR2                     //this farDDr2 would be the new section

        {

              ltedemo_Mem.obj (.far)          // load this .obj in farDDR ( DDR2) instead of far (L2)

        }

    }

     

    thanks!!,

    Kishore

  • Actually, including the SECTIONS in the linker cmd file  Cfg_p64Pe_x.xdl,    this approach works.

    But the thing is , i wont be able to allocate the created free space in L2 in my .cfg file. As if i build again the settings in xdl file is lost.

    I tried including SECTIONS in cfg file, but it wont take it.

     

    thanks,

  • Not sure if you are using BIOS 6.30 or not.  We updated the docs for 6.30 to have more details about memory.   Check Chapter 5 (sect 5.3.3) which summarizes how to use a custom linker.cmd file along with the generated .cmd file.

    If you have 6.30.02, you can get the doc in 'docs' directory or via link in release notes (or via Eclipse help TOC).

    If  you are using earlier version of BIOS, the concepts are still same.   You can get the latest doc here:

     

    http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/bios/sysbios/6_30_02_42/exports/docs/docs/Bios_User_Guide.pdf

  • Thanks  Karl, creating a new linker cmd file helped.