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.

aplay - memory leak



Hi,

I am working with DM368 based custom board. we have external codec interfaced to McBSP.

when we run aplay command i am observing memory leak.

the leak is around 12k everytime i do aplay. if i get any underruns the leak is more than 12k

the kernel version i am working is "Linux-2.6.32.17-davinci1".

The codec driver is in alsa model. could you please suggest how to resolve this problem.

Thank you, Sreedhar.

  • Hi,

    more details with statistics

    root@dm368-evm:/# free
                  total         used         free       shared      buffers
      Mem:        76384        22876        53508            0         3436
     Swap:            0            0            0
    Total:        76384        22876        53508


    root@dm368-evm:/# aplay usr/share/sounds/alsa/Front_Left.wav
    Playing WAVE 'usr/share/sounds/alsa/Front_Left.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono

    root@dm368-evm:/# free
                  total         used         free       shared      buffers
      Mem:        76384        23416        52968            0         3476
     Swap:            0            0            0
    Total:        76384        23416        52968

    root@dm368-evm:/# aplay usr/share/sounds/alsa/Front_Center.wav

    root@dm368-evm:/# free
                  total         used         free       shared      buffers
      Mem:        76384        23560        52824            0         3480
     Swap:            0            0            0
    Total:        76384        23560        52824

    root@dm368-evm:/# aplay usr/share/sounds/alsa/Side_Right.wav

    root@dm368-evm:/# free
                  total         used         free       shared      buffers
      Mem:        76384        23692        52692            0         3484
     Swap:            0            0            0
    Total:        76384        23692        52692

     

    Thank you, Sreedhar

     

  • Hi,

    The cat proc/meminfo details shows the memory missing seems to be added in active and cached section.

    root@dm368-evm:/# free
                  total         used         free       shared      buffers
      Mem:        57044        19900        37144            0            0
     Swap:            0            0            0
    Total:        57044        19900        37144
    root@dm368-evm:/# cat proc/meminfo
    MemTotal:          57044 kB
    MemFree:           37132 kB
    Buffers:               0 kB
    Cached:             8904 kB
    SwapCached:            0 kB
    Active:             4132 kB
    Inactive:           6196 kB
    Active(anon):       1452 kB
    Inactive(anon):       76 kB
    Active(file):       2680 kB
    Inactive(file):     6120 kB
    Unevictable:           0 kB
    Mlocked:               0 kB
    SwapTotal:             0 kB
    SwapFree:              0 kB
    Dirty:                 0 kB
    Writeback:             0 kB
    AnonPages:          1452 kB
    Mapped:             1520 kB
    Shmem:               104 kB
    Slab:               4676 kB
    SReclaimable:       1016 kB
    SUnreclaim:         3660 kB
    KernelStack:         256 kB
    PageTables:          176 kB
    NFS_Unstable:          0 kB
    Bounce:                0 kB
    WritebackTmp:          0 kB
    CommitLimit:       28520 kB
    Committed_AS:       4788 kB
    VmallocTotal:     960512 kB
    VmallocUsed:           8 kB
    VmallocChunk:     960472 kB





    root@dm368-evm:/# free
                  total         used         free       shared      buffers
      Mem:        57044        20044        37000            0            0
     Swap:            0            0            0
    Total:        57044        20044        37000
    root@dm368-evm:/# cat proc/meminfo
    MemTotal:          57044 kB
    MemFree:           36988 kB
    Buffers:               0 kB
    Cached:             9036 kB
    SwapCached:            0 kB
    Active:             4352 kB
    Inactive:           6120 kB
    Active(anon):       1464 kB
    Inactive(anon):       76 kB
    Active(file):       2888 kB
    Inactive(file):     6044 kB
    Unevictable:           0 kB
    Mlocked:               0 kB
    SwapTotal:             0 kB
    SwapFree:              0 kB
    Dirty:                 0 kB
    Writeback:             0 kB
    AnonPages:          1464 kB
    Mapped:             1548 kB
    Shmem:               104 kB
    Slab:               4680 kB
    SReclaimable:       1020 kB
    SUnreclaim:         3660 kB
    KernelStack:         256 kB
    PageTables:          176 kB
    NFS_Unstable:          0 kB
    Bounce:                0 kB
    WritebackTmp:          0 kB
    CommitLimit:       28520 kB
    Committed_AS:       4908 kB
    VmallocTotal:     960512 kB
    VmallocUsed:           8 kB
    VmallocChunk:     960472 kB




    root@dm368-evm:/# free
                  total         used         free       shared      buffers
      Mem:        57044        20036        37008            0            0
     Swap:            0            0            0
    Total:        57044        20036        37008

    root@dm368-evm:/# cat proc/meminfo
    MemTotal:          57044 kB
    MemFree:           36988 kB
    Buffers:               0 kB
    Cached:             9036 kB
    SwapCached:            0 kB
    Active:             4580 kB
    Inactive:           5892 kB
    Active(anon):       1464 kB
    Inactive(anon):       76 kB
    Active(file):       3116 kB
    Inactive(file):     5816 kB
    Unevictable:           0 kB
    Mlocked:               0 kB
    SwapTotal:             0 kB
    SwapFree:              0 kB
    Dirty:                 0 kB
    Writeback:             0 kB
    AnonPages:          1464 kB
    Mapped:             1548 kB
    Shmem:               104 kB
    Slab:               4676 kB
    SReclaimable:       1016 kB
    SUnreclaim:         3660 kB
    KernelStack:         256 kB
    PageTables:          176 kB
    NFS_Unstable:          0 kB
    Bounce:                0 kB
    WritebackTmp:          0 kB
    CommitLimit:       28520 kB
    Committed_AS:       4908 kB
    VmallocTotal:     960512 kB
    VmallocUsed:           8 kB
    VmallocChunk:     960472 kB


    how to get back the memory. I am  stuck with this problem for sometime, please provide some suggestions to resolve this problem.

    Advanced Linux Sound Architecture Driver Version 1.0.21.

    Any patch needs to be updated for the kernel?

    Thank you, Sreedhar.

  • HI Sridhar,

    Did you find solution to your problem?

    I am working with DM8148 EZSDK (linux based) and observed same problem. Wondering how did you resolved the issue.

    Kindest Regards,

    Salim

  • There is no leak. The memory is now being used to cache data instead of just sitting there being uselessly filled with zeroes.

    Under linux, memory reported as "Free" is actually "wasted" or "surplus" memory. If you have a high "free" number after hours of use, it means that you have too much RAM in your system for the tasks you're doing.

    Under normal use, "free" should drop to something close to zero, and "cached" should fill the rest.