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.

Where are heaps defined?

Expert 2220 points


Hello,

I am running a modified version of the capture encode demo in ezsdk 5.2.2.60. When running the code the OMX initialization comletes. Then, it tries to get the handles for the OMX components that the demo will be using. First it gets the Video capture component handle successfully, and then it tries to get the Control Component handle and the traces prints out that it is out of memory and it failed to allocate 412 bytes in heap 0x0. To see if it was someting specifically wrond with that component i switched the order of initialization of the two components. I put the control first and capture second. This time the control component worked and the capture component had the same error. This verified that it is indeed an out of memory condition. To verify this further i put a for loop around a Memory_alloc call and it was able to successfully declare 5  412 byte buffers before i got the out of memory condition. 

 

My question is this: What memory segment is heap 0 in and how can I make it larger?

I spent hours grepping around trying to figure out how this heap was declared but always got stuck with some mysterious xdc autogenerated stub function that i couldn't make any connection to.

 

Thanks,

Ben

  • Here is a little more specific information.

    First the off the memory allocation failure is occurring in OmxProxy_commonInit  in OmxProxy.c  at the following function

     

     pHandle->pComponentPrivate =    (PROXY_COMPONENT_PRIVATE *) Memory_alloc (OmxProxy_Module_heap (),  sizeof (PROXY_COMPONENT_PRIVATE),  sizeof (Ptr), &eb);

    The OmxProxy_Module_heap () function is statically defined to return a zero. 

    Both the capture component (OMX.TI.VPSSM3.VFCC) and the control component (OMX.TI.VPSSM3.CTRL.TVP) call the above Memory_alloc when the OMX_GetHandle function is called in ilclient.c

    Originally i assumed that heap 0 was declared in shared region zero, which i tried making larger but it didn't fix anything. I made the region larger and made sure that a heap was declared in the region, but did not see any way to declare the size of the heap so i assumed that the entire region would be a heap.

     

  • After some more looking I found that the default size is 0x1000 and is set in /xdc/packages/xdc/runtime/Memory.xdc 

    This is all well and good but when I change it the changes are not being rebuilt. (I checked this by putting total nonsense it and there was no build failure).

    My question has now become: How do I actually get the module (xdc.runtime.Memory)  to rebuild so i can change the heapsize?

    Thanks,

     

    Ben

  • Ben,

    It appears that you are having issues with allocating memory on Linux. Please check the bootargs. How much memory are you allocating to linux ? Since this is A8 code, (omx_proxy..)while you build ILClient, it gets built.

    Also, you could try just malloc to see if that is working fine. Also Please see following page

    http://processors.wiki.ti.com/index.php/EZSDK_Memory_Map

    Thanks

    Vimal

  • Thanks for the help. Apparently i had to declare a special heap size in the cfg file. the default was set to 0x1000 and i was running out of memory.