Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leaks in Alsa backend #928

Open
druskus20 opened this issue Nov 22, 2024 · 4 comments
Open

Memory leaks in Alsa backend #928

druskus20 opened this issue Nov 22, 2024 · 4 comments

Comments

@druskus20
Copy link

I am finding quite a lot of memory leaks when using Alsa, both on master and 0.15.3.

==1297036== 1,512 bytes in 21 blocks are possibly lost in loss record 142 of 164
==1297036==    at 0x484D953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==1297036==    by 0x48B3D92: ??? (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0)
==1297036==    by 0x48C4C44: ??? (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0)
==1297036==    by 0x48C5289: ??? (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0)
==1297036==    by 0x48CFD84: snd_config_update_r (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0)
==1297036==    by 0x48D0447: snd_config_update_ref (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0)
==1297036==    by 0x48FB35F: snd_pcm_open (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0)
==1297036==    by 0x4E95A4: alsa::pcm::PCM::open (error.rs:21)
==1297036==    by 0x4E94A0: alsa::pcm::PCM::new (pcm.rs:147)
==1297036==    by 0x4D9F04: cpal::host::alsa::DeviceHandles::try_open (mod.rs:214)
==1297036==    by 0x4DA099: cpal::host::alsa::DeviceHandles::take (mod.rs:233)
==1297036==    by 0x4DA372: cpal::host::alsa::Device::build_stream_inner (mod.rs:251)
==1297036==

This can be seen in some of the examples, for example feedback.

 valgrind -s --leak-check=full --show-leak-kinds=all ./target/debug/examples/feedback

Seems to be the same as this:

jarikomppa/soloud#278

@druskus20
Copy link
Author

druskus20 commented Nov 22, 2024

Looking a bit further into this I realized it is an issue with alsa-rs itself. I opened an issue there.

@druskus20
Copy link
Author

druskus20 commented Nov 24, 2024

Issue is fixed in alsa-rs - a simple upgrade whenever a new alsa_rs version is released will fix this issue

@bluenote10
Copy link

Thanks for looking into this, and the update on it!

Doesn't the fix in diwic/alsa-rs@e560e9d suggest that update_free_global now needs to be called pro-actively by cpal?

@druskus20
Copy link
Author

Oh yeah, fair - sorry completely my bad (my PR is the one that fixed it automatically 😅)

We should either assume a reasonable default or allow the user to free the global config on demand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants