Skip to contentSkip to conversation

dsnoop memory leak

DISCUSSION Иван Больсунов 2 participants 2 messages May 31, 2013 – Jun 4, 2013 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

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)

#2 lore raw
Quoted 2 lines · Иван Больсунов

==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)

I fixed this issue in this commit:

http://git.alsa-project.org/?p=alsa-lib.git;a=commitdiff;h=ca487c9511c1500184023dfea803a5e785d725e2

Thank you for your report.

Jaroslav

Signature · 7 lines
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project; Red Hat, Inc.
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel