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.

algFree doesn't be invoked



hi,

these days I was implementing a new codec on dm6446, and then I used xdm to encapsulate this codec, later I added it into the decodeCombo.x64P, meanwhile I use decode demo to test the new decodeCombo.x64P.

when I was using the xdm to encapsulate the codec, I realized these functions:

#pragma CODE_SECTION(TREMORDEC_TI_control, ".text:algControl")
#pragma CODE_SECTION(TREMORDEC_TI_process, ".text:algProcess")
#pragma CODE_SECTION(TREMORDEC_TI_initObj, ".text:algInit")
#pragma CODE_SECTION(TREMORDEC_TI_free,    ".text:algFree")
#pragma CODE_SECTION(TREMORDEC_TI_alloc,   ".text:algAlloc")

when the codec was created, it would invoke algAlloc and algInit, and I allocated some memory for the codec in algAlloc.

when the codec was running, it would invoke algControl and algProcess.

as I think, we I use AUDDEC1_delete to delete the codec, it should invoke algFree. but actully it doesn't.

so when we created and deleted the codec some times, it will be failed. And I think the memory allocated in algAlloc doesn't be released.


and the log info as follows:


@11,483,482us: [+0 T:0x413f5490] ti.sdo.ce.audio1.AUDDEC1 - AUDDEC1_delete> Enter (handle=0x414005b0)
@11,483,637us: [+0 T:0x413f5490] CV - VISA_delete(0x414005b0)
@11,483,733us: [+5 T:0x413f5490] CV - VISA_delete> deleting codec (localQueue=0x10002, remoteQueue=0x2)
@11,484,125us: [+0 T:0x413f5490] CE - Engine_deleteNode(0x41400490)
@11,485,268us: [+5 T:0x413f5490] CE - Engine_deleteNode(0x41400490): algName = aachedec, algHandle = 0x8fa05748, stack size = 13312, stack used = 5467(42%)
@11,485,942us: [+0 T:0x413f5490] ti.sdo.ce.audio1.AUDDEC1 - AUDDEC1_delete> return


so in codec engine, it doesn't invoke Algorithm_delete at all, then algFree wouldn't be invoked.

so can you help to solve this problem?

thanks very much!

  • There is one core XDAIS problem with your audio codec based on the description above:

    XDAIS (TMS320 Algorithm Standard) compliant algorithms are *not* allowed to allocate/deallocate any memory. Instead they are required to use IALG interface to publish their instance memory requirement via IALG::algAlloc(), and receive framework supplied memory via IALG::algInit() functions. 

    Additionally, your expectation of the IALG:algFree() function is not as it is specified/intended by the spec:

    XDAIS does not require the framework to call IALG::algFree() function, even though it requires the algorithm to implement this function. The purpose of this function is to return back to the framework the list of IALG supplied memory descriptors, so that the framework can ultimately de-allocate/reclaim what was allocated. However, as in the case of CE, the framework may already be doing its own bookkeeping and may not need to call IALG::algFree() during the delete stage of an algorithm instance. The algorithm should not rely on or require its ::algFree function to be called at any stage.

    The names of these functions (algAlloc & algFree) unfortunately often confuse programmers, but I hope this explanation helps and point you in the right direction. You should consult the XDAIS IALG specification for more details

     

    Murat