memory leaks in libasound2

Bug #1017375 reported by ArdyFalls
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
alsa-lib (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

libasound has many memory leaks. I have provided some sample code and the valgrind output...

sample code attached: alsa-async.c
valgrind output: valgrind.txt

Kubuntu: 12.04 AMD64
Kernel: Linux 3.2.0-25-generic #40-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux

lspci output:
00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port (rev 09)
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)
00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 05)
00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 05)
00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b5)
00:1c.1 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 2 (rev b5)
00:1c.3 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 4 (rev b5)
00:1c.4 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 5 (rev b5)
00:1c.5 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 6 (rev b5)
00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 05)
00:1f.0 ISA bridge: Intel Corporation HM67 Express Chipset Family LPC Controller (rev 05)
00:1f.2 SATA controller: Intel Corporation 6 Series/C200 Series Chipset Family 6 port SATA AHCI Controller (rev 05)
00:1f.3 SMBus: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller (rev 05)
01:00.0 VGA compatible controller: NVIDIA Corporation GF108 [GeForce GT 540M] (rev ff)
03:00.0 Network controller: Intel Corporation Centrino Advanced-N 6230 (rev 34)
04:00.0 USB controller: NEC Corporation uPD720200 USB 3.0 Host Controller (rev 04)
06:00.0 Ethernet controller: Atheros Communications Inc. AR8151 v2.0 Gigabit Ethernet (rev c0)

Revision history for this message
ArdyFalls (afalls) wrote :
Revision history for this message
ArdyFalls (afalls) wrote :

oops here is the valgrind output.

Revision history for this message
ArdyFalls (afalls) wrote :

Some of the 'leaks' can be removed by calling snd_config_update_free_global(), but this still leaves many reachable blocks...

updated test code attached: alsa-async.c

come of the valgrind output...

==5312== Memcheck, a memory error detector
==5312== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==5312== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==5312== Command: ./alsa-async /home/ardy/workspace/ASound/res/raw/explosion.ogg
==5312==
Initalize alsa {2 channels, 44100hz}
==5312==
==5312== HEAP SUMMARY:
==5312== in use at exit: 29,519 bytes in 86 blocks
==5312== total heap usage: 3,726 allocs, 3,640 frees, 489,389,315 bytes allocated
==5312==
==5312== 11 bytes in 1 blocks are still reachable in loss record 1 of 21
==5312== at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==5312== by 0x869B766: pa_xmalloc (in /usr/lib/x86_64-linux-gnu/libpulsecommon-1.1.so)
==5312== by 0x869D9E8: ??? (in /usr/lib/x86_64-linux-gnu/libpulsecommon-1.1.so)
==5312== by 0x86B00B7: pa_log_set_ident (in /usr/lib/x86_64-linux-gnu/libpulsecommon-1.1.so)
==5312== by 0x86B02A5: ??? (in /usr/lib/x86_64-linux-gnu/libpulsecommon-1.1.so)
==5312== by 0x86B0504: pa_log_levelv_meta (in /usr/lib/x86_64-linux-gnu/libpulsecommon-1.1.so)
==5312== by 0x86B0397: pa_log_level_meta (in /usr/lib/x86_64-linux-gnu/libpulsecommon-1.1.so)
==5312== by 0x86B3864: pa_mempool_new (in /usr/lib/x86_64-linux-gnu/libpulsecommon-1.1.so)
==5312== by 0x8249824: pa_context_new_with_proplist (in /usr/lib/x86_64-linux-gnu/libpulse.so.0.13.5)
==5312== by 0x803AA3B: ???
==5312== by 0x4E60EBC: ??? (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0)
==5312== by 0x4E614C3: snd_config_searcha_hooks (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0)
==5312==
........<cut out much of the output>........
==5312==
==5312== LEAK SUMMARY:
==5312== definitely lost: 0 bytes in 0 blocks
==5312== indirectly lost: 0 bytes in 0 blocks
==5312== possibly lost: 0 bytes in 0 blocks
==5312== still reachable: 29,519 bytes in 86 blocks
==5312== suppressed: 0 bytes in 0 blocks
==5312==
==5312== For counts of detected and suppressed errors, rerun with: -v
==5312== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in alsa-lib (Ubuntu):
status: New → Confirmed
Revision history for this message
ALinuxUser (buntulongername-new) wrote :

This bug report is now very old, but is this bug still present?

Here is why I ask.

Running valgrind on a C program - a program that I adapted from someone else - showed a lot of possible leaks. But I learnt from this the present bug report to do 'snd_config_update_free_global()'. Having done that, I see - only - the following.

================================================================

$ valgrind --leak-check=yes --show-reachable=no ./volume_exec
==683808== Memcheck, a memory error detector
==683808== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==683808== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==683808== Command: ./volume_exec
==683808==
==683808== Conditional jump or move depends on uninitialised value(s)
==683808== at 0x51A1565: pa_shm_cleanup (in /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-13.99.so)
==683808== by 0x51A17A1: pa_shm_create_rw (in /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-13.99.so)
==683808== by 0x51914B6: pa_mempool_new (in /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-13.99.so)
==683808== by 0x51169B1: pa_context_new_with_proplist (in /usr/lib/x86_64-linux-gnu/libpulse.so.0.21.2)
==683808== by 0x484B2B6: conf_pulse_hook_load_if_running (in /usr/lib/x86_64-linux-gnu/alsa-lib/libasound_module_conf_pulse.so)
==683808== by 0x48A50DD: ??? (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0)
==683808== by 0x48A5544: ??? (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0)
==683808== by 0x48A5F21: snd_config_searcha_hooks (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0)
==683808== by 0x48A6010: snd_config_searchva_hooks (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0)
==683808== by 0x48A611A: ??? (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0)
==683808== by 0x48A48F5: snd_config_search_definition (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0)
==683808== by 0x48AF17D: ??? (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0)
==683808==
x==683808==
==683808== HEAP SUMMARY:
==683808== in use at exit: 78,125 bytes in 194 blocks
==683808== total heap usage: 6,002 allocs, 5,808 frees, 743,291 bytes allocated
==683808==
==683808== LEAK SUMMARY:
==683808== definitely lost: 0 bytes in 0 blocks
==683808== indirectly lost: 0 bytes in 0 blocks
==683808== possibly lost: 0 bytes in 0 blocks
==683808== still reachable: 78,125 bytes in 194 blocks
==683808== suppressed: 0 bytes in 0 blocks
==683808== Reachable blocks (those to which a pointer was found) are not shown.
==683808== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==683808==
==683808== Use --track-origins=yes to see where uninitialised values come from
==683808== For lists of detected and suppressed errors, rerun with: -s
==683808== ERROR SUMMARY: 2 errors from 1 contexts (suppressed: 0 from 0)

================================================================

Does that output indicate a problem? I libasound2-dev:amd64 (1.2.2-2.1ubuntu2.5) (on Linux Mint 20.3).

Revision history for this message
Jasmine (jasmine21) wrote :

Hello,
May I know have you solved the above problem? I also encounter valgrind said there is memory leak in libasound2 for aarch64 architecture device. I also not sure how to solve the issue.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.