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

When I run paex_sine_c++.cpp there is a memory leak #996

Open
lzw12138 opened this issue Jan 2, 2025 · 2 comments
Open

When I run paex_sine_c++.cpp there is a memory leak #996

lzw12138 opened this issue Jan 2, 2025 · 2 comments
Labels
bug Something isn't working linux Affects Linux src-alsa ALSA Host API /src/hostapi/alsa

Comments

@lzw12138
Copy link

lzw12138 commented Jan 2, 2025

When I run paex_sine_c++.cpp there is a memory leak
i use valgrind --track-origins=yes --leak-check=full --show-leak-kinds=all ./portaudio_test
ressult is
==14001== 1,360 bytes in 1 blocks are definitely lost in loss record 97 of 109
==14001== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==14001== by 0x485C8F7: ???
==14001== by 0x4EB8F4F: ??? (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0)
==14001== by 0x4EB95CF: ??? (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0)
==14001== by 0x4EE3CC8: snd_pcm_open (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0)
==14001== by 0x489C7BC: ??? (in /usr/lib/x86_64-linux-gnu/libportaudio.so.2.0.0)
==14001== by 0x48A19C1: ??? (in /usr/lib/x86_64-linux-gnu/libportaudio.so.2.0.0)
==14001== by 0x48A232C: PaAlsa_Initialize (in /usr/lib/x86_64-linux-gnu/libportaudio.so.2.0.0)
==14001== by 0x489504D: Pa_Initialize (in /usr/lib/x86_64-linux-gnu/libportaudio.so.2.0.0)
==14001== by 0x109AE6: ScopedPaHandler::ScopedPaHandler() (main.cpp:225)
==14001== by 0x1094C3: main (main.cpp:251)
.....
==14001== LEAK SUMMARY:
==14001== definitely lost: 2,944 bytes in 4 blocks
==14001== indirectly lost: 0 bytes in 0 blocks
==14001== possibly lost: 0 bytes in 0 blocks
==14001== still reachable: 82,397 bytes in 204 blocks
==14001== suppressed: 0 bytes in 0 blocks

I don't know how to deal with him because paex_sine_c++.cpp is example demo
He should usually be fine

portaudio 19.6.0-1.1
aplay: version 1.2.6 by Jaroslav Kysela [email protected]

@RossBencina
Copy link
Collaborator

I don't know how to interpret valgrind output, but it looks like it's leaked inside ALSA. Do you see the same leak in other examples? in the C examples?

@RossBencina RossBencina added src-alsa ALSA Host API /src/hostapi/alsa linux Affects Linux labels Jan 17, 2025
@philburk
Copy link
Collaborator

I checked paex_sine.c. It cleans up by calling Pa_CloseStream() and Pa_Terminate().

PaAlsa_Initialize() opens lots of streams to check the device capabilities.
It may not be cleaning up correctly.

@philburk philburk added the bug Something isn't working label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working linux Affects Linux src-alsa ALSA Host API /src/hostapi/alsa
Projects
None yet
Development

No branches or pull requests

3 participants