Summary: | alsa: hctl memory leak | ||
---|---|---|---|
Product: | PulseAudio | Reporter: | Tanu Kaskinen <tanuk> |
Component: | alsa | Assignee: | pulseaudio-bugs |
Status: | RESOLVED FIXED | QA Contact: | pulseaudio-bugs |
Severity: | normal | ||
Priority: | medium | CC: | lennart |
Version: | unspecified | ||
Hardware: | Other | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: |
Description
Tanu Kaskinen
2014-01-30 09:14:12 UTC
I found this as well a while back. I investigated a little further. Pulseaudio's
handling seems to be fine since mixer_close() also calls free on the mixer.
Here is a valgrind report with full debugging symbols.
==12209== HEAP SUMMARY:
==12209== in use at exit: 54,987 bytes in 175 blocks
==12209== total heap usage: 61,729 allocs, 61,554 frees, 8,849,995 bytes allocated
==12209==
==12209== 80 bytes in 5 blocks are definitely lost in loss record 20 of 29
==12209== at 0x4C27730: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==12209== by 0x1063B06E: bag_new (bag.c:26)
==12209== by 0x1063B6B7: hctl_event_handler (mixer.c:177)
==12209== by 0x1062DC0E: snd_hctl_throw_event (hcontrol.c:205)
==12209== by 0x1062EA94: snd_hctl_load (hcontrol.c:614)
==12209== by 0x1063C24B: snd_mixer_load (mixer.c:576)
==12209== by 0x103BAFE2: prepare_mixer (alsa-util.c:1506)
==12209== by 0x103BB374: pa_alsa_open_mixer (alsa-util.c:1529)
==12209== by 0x101A5868: module_alsa_card_LTX_pa__init (module-alsa-card.c:503)
==12209== by 0x4E5E184: pa_module_load (module.c:174)
==12209== by 0xFD8B8D6: verify_access (module-udev-detect.c:341)
==12209== by 0xFD8CB2E: module_udev_detect_LTX_pa__init (module-udev-detect.c:489)
==12209==
==12209== LEAK SUMMARY:
==12209== definitely lost: 80 bytes in 5 blocks
==12209== indirectly lost: 0 bytes in 0 blocks
==12209== possibly lost: 0 bytes in 0 blocks
==12209== still reachable: 54,907 bytes in 170 blocks
==12209== suppressed: 0 bytes in 0 blocks
So in this Pulseaudio run, alsa-lib calls bag_new 177 times, but it frees only
172 bags (this was checked by adding printf statements after a bag was added/removed,
if anyone wonders).
Now there is a nice warning file about leaks in the alsa-lib source tree:
> The biggest reported leak is that the global configuration is cached for
> next usage. If you do not want this feature, simply, call
> snd_config_update_free_global() after all snd_*_open*() calls. This function
> will free the cache.
I haven't investigated if this warning applies to us.
http://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/src/modules/alsa/alsa-mixer.c?id=dedf1340c611c3d9b17a08e0ee18ae22afac623c this patch mention "+/* We can listen to either a snd_hctl_t or a snd_mixer_t, but not both */" do this mean the mixer events from other mixer applications were no longer received after jack detection using hctl ? Patch set posted here: http://lists.freedesktop.org/archives/pulseaudio-discuss/2014-September/021422.html (In reply to comment #1) > > The biggest reported leak is that the global configuration is cached for > > next usage. If you do not want this feature, simply, call > > snd_config_update_free_global() after all snd_*_open*() calls. This function > > will free the cache. > > I haven't investigated if this warning applies to us. We call snd_config_update_free_global when we quit PulseAudio (see alsa-util.c, function pa_alsa_refcnt_dec), so this should be okay. David, is this bug fixed? I believe it is fixed now - I pushed the patch set a few months ago. Feel free to reopen if you still see it. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.