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.

TI-RTOS (TIVAC) Web Server and memory overflow?

Other Parts Discussed in Thread: SYSBIOS

Hi ,
I'm working with TI-RTOS as Web Server.

TI-RTOS : tirtos_tivac_2_10_01_38

NDK: ndk_2_24_01_18

Microcontroller: TM4C192ENCPDTI34BA72JW

After some time (one hour) gives me the following error:

It seems to be overflow memory, but because reason this occurs?
How can I solve the problem?
A part of app.cfg:

/*
 * The BIOS module will create the default heap for the system.
 * Specify the size of this default heap.
 */
BIOS.heapSize = 150000;

/*
 * Build a custom SYS/BIOS library from sources.
 */
BIOS.libType = BIOS.LibType_NonInstrumented;

/* System stack size (used by ISRs and Swis) */
Program.stack = 8192; //4096

/* Circular buffer size for System_printf() */
SysMin.bufSize = 0x200;

/*
 * Create and install logger for the whole system
 */
//var loggerBufParams = new LoggerBuf.Params();
//loggerBufParams.numEntries = 16;
//var logger0 = LoggerBuf.create(loggerBufParams);
//Defaults.common$.logger = logger0;
Main.common$.diags_INFO = Diags.ALWAYS_ON;

System.SupportProxy = SysMin;
var task0Params = new Task.Params();
task0Params.instance.name = "heartBeat";
task0Params.stackSize = 512;
task0Params.arg0 = 1000;
Program.global.heartBeat = Task.create("&heartBeatFxn", task0Params);
TIRTOS.useGPIO = true;
Global.IPv6 = true;
Ip.autoIp = true;
Ip.address = "";
Ip.mask = "255.255.255.0";
Ip.gatewayIpAddr = "192.168.1.254";
Global.stackInitHook = "&AddWebFiles";
Global.stackDeleteHook = "&RemoveWebFiles";
Global.stackBeginHook = null;
Global.networkOpenHook = "&newIPAddr";



var task1Params = new Task.Params();
task1Params.instance.name = "receive_usb";
task1Params.priority = 2;
task1Params.stackSize = 768;
task1Params.stackSection = ".bss";
task1Params.vitalTaskFlag = false;
Program.global.receive_usb = Task.create("&receiveFxn", task1Params);
var task2Params = new Task.Params();
task2Params.instance.name = "transmit_usb";
task2Params.priority = 2;
task2Params.stackSize = 768;
task2Params.stackSection = ".bss";
task2Params.vitalTaskFlag = false;
Program.global.transmit_usb = Task.create("&transmitFxn", task2Params);
TIRTOS.libType = TIRTOS.LibType_NonInstrumented;
BIOS.assertsEnabled = false;
BIOS.logsEnabled = false;
Idle.idleFxns[0] = "&Function_Idle";
TIRTOS.useUART = true;
Idle.idleFxns[1] = null;
var http0Params = new Http.Params();
http0Params.maxCon = 4;
var http0 = Http.create(http0Params);
Tcp.maxNumReasmPkts = 4;
var semaphore0Params = new Semaphore.Params();
semaphore0Params.instance.name = "DataLoopSem";
Program.global.DataLoopSem = Semaphore.create(null, semaphore0Params);
var task3Params = new Task.Params();
task3Params.instance.name = "DataLoop_App_Handle";
task3Params.priority = 3;
task3Params.stackSize = 1024;
Program.global.DataLoop_App_Handle = Task.create("&DataLoop_App_Task", task3Params);
Task.defaultStackSize = 1024;
Global.networkIPAddrHook = "&mynetworkIPAddrHook";
Global.lowTaskStackSize = 1024;
Global.normTaskStackSize = 1024;
Global.highTaskStackSize = 2048;
Global.ndkThreadStackSize = 2048;
Tcp.transmitBufSize = 4096;
Tcp.receiveBufSize = 4096;
Tcp.receiveBufLimit = 4096;
Global.memRawPageSize = 6153;
BIOS.heapTrackEnabled = false;
Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;
Ip.socketBufMinTxSize = 1024;
Ip.socketMaxConnections = 8;
Global.memRawPageCount = 8;
BIOS.customCCOpts = "--endian=little -mv7M4 --abi=eabi --float_support=fpv4spd16 -q -ms --opt_for_speed=2  --program_level_compile -o3 -g --optimize_with_debug";
Task.idleTaskStackSize = 1024;

Update:

It seems that there is an internal error in the function IDLE, which causes memory not be released by "dchild".


How do I know what causes this internal error?

Regards
Aquino

  • Hi Aquino,

    It looks like you have lots of terminated dchilds.

    What is the value for Task.deleteTerminatedTasks in your .cfg? Can you try setting it to true?

    When it is set to true, the Idle task will delete the tasks (basically garbage collection). Of course if the application is CPU bound and Idle never runs, you could get a pile-up of dchild also.

    Todd

  • Hi Todd,
    Thank you for your response.
    I have in app.cfg:
    Task.deleteTerminatedTasks = true;
    I have a task IDLE, but it is not clear tasks (dchilds).
    Is there a command for this?
    However changed the following value:
    Global.pktNumFrameBufs = 16; for Global.pktNumFrameBufs = 10;
    and it seems has improved. For now there again block.
    But still continues to appear "TcpTimeoutRexmt: Retransmit Timeout" after a "Service Status: dhcpc: Enabled: Running: 019". Reason why?

    Regards
    Aquino
  • Aquino,

    The "Retransmit Timeout" are fine.

    So with the larger Global.pktNumFrameBufs  and Global.pktNumFrameBufs, are you running out of memory?

    The Idle task gets plugged with the clean-up function automatically if Task.deleteTerminatedTasks = true. If you open Idle in ROV, you should see Task_deleteTerminatedTasksFunc in the list.

    Todd

  • Hi Todd,
    Yes increasing the Global.pktNumFrameBufs (eg 16) without faster memory.
    In ROV IDLE can see    ->   ti_sysbios_knl_Task_deleteTerminatedTasksFunc_I,
    in app.cfg have   -> Task.deleteTerminatedTasks = true;
    But for some reason unknown to dchold continues to fill the memory.

    The "Retransmit Timeout" is normal?

    The problem I have is that "dchild" does not release memory at certain times. Is there any solution?

    It seems that there is an internal error in the function IDLE, which causes memory not be released by "dchild".

    SEE ON TOP IMAGE UPDATED

    How do I know what causes this internal error?

    Aquino

  • Did you plug anything into the Idle Task in the .cfg file? If you did, does it call a blocking API (e.g. Semaphore_pend). You can look at  the idle functions in ROV to see what is there. As I noted earlier, "Task_deleteTerminatedTasksFunc" should be there.

    "Internal Error" in the Task view in ROV occurs when there is a problem with the item that the task is pending on. The Idle task should never pend on something.

    Can you put a breakpoint at "ti_sysbios_knl_Idle_run__E"? This is the loop that executes the idle functions. Of course, this will never be hit if you are CPU bound and idle never gets a chance to run.

    Todd

  • Hi Todd
    The "Task_deleteTerminatedTasksFunc" ROV is in IDLE.
    See the image above.
    Ie it exists, which makes pending task? I do not understand the task to be pending.

    I have put an breakpoint at "ti_sysbios_knl_Idle_run__E" in Idle.h but never gets hit!
    I'm not understand!


    Aquino
  • Aquino,

    What is Function_Idle() doing? It must run to completion without blocking (e.g. call Semaphore_pend or write out a driver that blocks on a semaphore). It should not be polling either.

    Todd

  • Hi Todd,

    This function was created by me and is only doing this:

    void Function_Idle (void)
    {
    i16IdleCount += 1;
    Log_info1("Idle TOGGLED [%u] times", i16IdleCount);
    }

    Already deleted this function also, however I still have the same problem!

    Regards
    Aquino
  • Aquino,

    Ok. The other potential reason is that you are CPU bound (i.e. using 100% of the CPU), so Idle never runs. Do you have a Task that is polling for a long time or a Hwi that runs so frequently, that it is starving the system.. Also, make sure any Hwi or Swi runs to completion (e.g. it is not spinning in a loop forever).

    Can you verifiy that you did not overflow the System Stack (ROV->Hwi->Module) and any Task stacks (ROV->Task->Detailed)?

    Todd

     

     

  • Hi Todd,
    I think I found the problem.
    Had one other a Task that is polling for a long time.
    Thank you for your help!

    Aquino