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 to check or change the stack size/heap size ?

In Linux SDK, where can I check or change the stack size and heap size of the ARM program and DSP program ?

  • For the stack size of a DSP program, perhaps look a the linker command file for the DSP program.
    On the arm to get the current Stack size, 
    root@am180x-evm:~# ulimit -a
    time(seconds)        unlimited
    file(blocks)         unlimited
    data(kb)             unlimited
    stack(kb)            8192
    coredump(blocks)     0
    memory(kb)           unlimited
    locked memory(kb)    64
    process              989
    nofiles              1024
    vmemory(kb)          unlimited
    locks                unlimited
     
    << setting the stack size on the ARM to 32K >>
    root@am180x-evm:~# ulimit -s 32768
    root@am180x-evm:~# ulimit -a
    time(seconds)        unlimited
    file(blocks)         unlimited
    data(kb)             unlimited
    stack(kb)            32768
    coredump(blocks)     0
    memory(kb)           unlimited
    locked memory(kb)    64
    process              989
    nofiles              1024
    vmemory(kb)          unlimited
    locks                unlimited
     
  • Hi Schuyler,

     

    Your method is not a permanent change because I need to change it every time when I run the program.

    How can I change stack size permanently so that when I compile and run the ARM program, the change is permanent ?

    Similarly, how to permanently change the heap size size of the ARM program ?

     

    Thanks,

    Mr Tan

     

  • There are no limits stored in the program file.

    Heap and stack sizes are user resource limits, which can be set for all programs run from a shell with the ulimit command, or from the program itself with the setrlimit system call (if the user has sufficient privileges; see the man page).

  • Hi,

    I am using am335x platform and running my customized applications using SDK7. I am running some apps in background monitoring.

    After some time my system is very slow. Is there any chance to improve my system with good performance using any ulimit command.

    In my system the below parameters are default configured. 

    root@am335x-evm:~# ulimit -a
    core file size (blocks, -c) 0
    data seg size (kbytes, -d) unlimited
    scheduling priority (-e) 0
    file size (blocks, -f) unlimited
    pending signals (-i) 3775
    max locked memory (kbytes, -l) 64
    max memory size (kbytes, -m) unlimited
    open files (-n) 1024
    pipe size (512 bytes, -p) 8
    POSIX message queues (bytes, -q) 819200
    real-time priority (-r) 0
    stack size (kbytes, -s) 8192
    cpu time (seconds, -t) unlimited
    max user processes (-u) 3775
    virtual memory (kbytes, -v) unlimited
    file locks (-x) unlimited

    do the needful.

    Regards,

    Lofna

     

  • ulimit is a mechnism to limit resources. It cannot be used to give you more resources than your machine actually has.

    If your system becomes slow after some time, the most likely reason is that your applications leak memory.