[alsa-devel] possibly memory leak in alsa-lib
The following program shows a few leaks in valgrind (ubuntu 12.04, alsa-lib 1.0.25, eglibc 2.15):
#include <alsa/asoundlib.h>
int main() { snd_pcm_t* pcm = 0; snd_pcm_open(&pcm, "default", SND_PCM_STREAM_PLAYBACK, 0); snd_pcm_close(pcm); snd_config_update_free_global(); }
Do I close pcm correctly? In file MEMORY-LEAK it is written that program should call snd_config_update_free_global() to free global configuration cache and I do so.
I'm not sure, but probably some leaks are caused by glibc.
On Tue, 30 Oct 2012 02:12:55 +0400 Ivan Sorokin vanyacpp@gmail.com wrote:
The following program shows a few leaks in valgrind (ubuntu 12.04, alsa-lib 1.0.25, eglibc 2.15):
#include <alsa/asoundlib.h>
int main() { snd_pcm_t* pcm = 0; snd_pcm_open(&pcm, "default", SND_PCM_STREAM_PLAYBACK, 0); snd_pcm_close(pcm); snd_config_update_free_global(); }
Do I close pcm correctly? In file MEMORY-LEAK it is written that program should call snd_config_update_free_global() to free global configuration cache and I do so.
I'm not sure, but probably some leaks are caused by glibc.
Most of them are glibc leaks, but I found a little issue in alsa-lib, too. This commit should fix it:
http://git.alsa-project.org/?p=alsa-lib.git;a=commitdiff;h=edcd677bf2065c560...
Thanks, Jaroslav
On 30.10.2012 14:48, Jaroslav Kysela wrote:
On Tue, 30 Oct 2012 02:12:55 +0400 Ivan Sorokin vanyacpp@gmail.com wrote:
The following program shows a few leaks in valgrind (ubuntu 12.04, alsa-lib 1.0.25, eglibc 2.15):
I'm not sure, but probably some leaks are caused by glibc.
Most of them are glibc leaks, but I found a little issue in alsa-lib, too. This commit should fix it:
http://git.alsa-project.org/?p=alsa-lib.git;a=commitdiff;h=edcd677bf2065c560...
Thank you very much. I looked into those leaks in glibc and they appeared to be fixed (at least some of them):
http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=d44638b0a7fc1f01c3b215...
Sadly this fix is in 2.16 and ubuntu 12.04 is shipped with glibc 2.15. When I get next version of glibc, I will check my program again.
participants (2)
-
Ivan Sorokin
-
Jaroslav Kysela