Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Иван Больсунов" <bolsunov@telum.ru>
To: alsa-devel@alsa-project.org
Subject: dsnoop memory leak
Date: Fri, 31 May 2013 17:58:17 +0400 (MSK)	[thread overview]
Message-ID: <103845287.94506.1370008697164.JavaMail.root@telum.ru> (raw)
In-Reply-To: <732607619.94502.1370008560183.JavaMail.root@telum.ru>

Since alsa bug tracker does not work for me for weeks, I have to report bug here. Sorry if it a wrong place.

So, to reproduce memory leak (Alsa lib used v.1.0.27), you have to use next asound.conf:

pcm_slave.myslave
{
    pcm                 "hw:0,0"
}

pcm.mysnoop
{
    type                dsnoop
    ipc_key             1024
    slave               myslave
}

Then you simply do:

snd_pcm_open(&pcm_handle, "mysnoop", SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK);
snd_pcm_close(pcm_handle);
snd_config_update_free_global();

Valgrind will show something like this:

==7889== 
==7889== HEAP SUMMARY:
==7889==     in use at exit: 15,854 bytes in 871 blocks
==7889==   total heap usage: 333,212 allocs, 332,341 frees, 11,695,490 bytes allocated
==7889== 
==7889== 15,834 (6,264 direct, 9,570 indirect) bytes in 174 blocks are definitely lost in loss record 6 of 6
==7889==    at 0x4027CBF: calloc (vg_replace_malloc.c:566)
==7889==    by 0x406B416: _snd_config_make (in /usr/lib/libasound.so.2.0.0)
==7889==    by 0x406C69C: snd_config_make (in /usr/lib/libasound.so.2.0.0)
==7889==    by 0x406C861: snd_config_make_compound (in /usr/lib/libasound.so.2.0.0)
==7889==    by 0x406D00C: _snd_config_copy (in /usr/lib/libasound.so.2.0.0)
==7889==    by 0x406F112: snd_config_walk (in /usr/lib/libasound.so.2.0.0)
==7889==    by 0x406FE04: snd_config_copy (in /usr/lib/libasound.so.2.0.0)
==7889==    by 0x4070370: snd_config_expand (in /usr/lib/libasound.so.2.0.0)
==7889==    by 0x407107E: snd_config_search_definition (in /usr/lib/libasound.so.2.0.0)
==7889==    by 0x40D2C22: _snd_pcm_direct_get_slave_ipc_offset (in /usr/lib/libasound.so.2.0.0)
==7889==    by 0x40D68A2: snd1_pcm_direct_parse_open_conf (in /usr/lib/libasound.so.2.0.0)
==7889==    by 0x40D28CA: _snd_pcm_dsnoop_open (in /usr/lib/libasound.so.2.0.0)
==7889==    by 0x40909C4: snd_pcm_open_conf (in /usr/lib/libasound.so.2.0.0)
==7889==    by 0x4091036: snd_pcm_open_noupdate (in /usr/lib/libasound.so.2.0.0)
==7889==    by 0x804873D: main (in /home/blah/al/a.out)
==7889== 
==7889== LEAK SUMMARY:
==7889==    definitely lost: 6,264 bytes in 174 blocks
==7889==    indirectly lost: 9,570 bytes in 696 blocks
==7889==      possibly lost: 0 bytes in 0 blocks
==7889==    still reachable: 20 bytes in 1 blocks
==7889==         suppressed: 0 bytes in 0 blocks
==7889== Reachable blocks (those to which a pointer was found) are not shown.
==7889== To see them, rerun with: --leak-check=full --show-reachable=yes
==7889== 
==7889== For counts of detected and suppressed errors, rerun with: -v
==7889== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

       reply	other threads:[~2013-05-31 13:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <732607619.94502.1370008560183.JavaMail.root@telum.ru>
2013-05-31 13:58 ` Иван Больсунов [this message]
2013-06-04 14:02   ` dsnoop memory leak Jaroslav Kysela
     [not found] <370949076.4726.1370352588794.JavaMail.root@telum.ru>
2013-06-04 13:33 ` Ivan Bolsunov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=103845287.94506.1370008697164.JavaMail.root@telum.ru \
    --to=bolsunov@telum.ru \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox