mk-fg / python-pulse-control

Python high-level interface and ctypes-based bindings for PulseAudio (libpulse)
https://pypi.org/project/pulsectl/
MIT License
170 stars 36 forks source link

Fix memory leak in get_peak_sample() #72

Closed Taka-Kazu closed 2 years ago

Taka-Kazu commented 2 years ago

This PR fixes a memory leak in get_peak_sample().

My environment

How to reproduce

Run below script and check the memory usage of the process. With master, the memory usage will continuously increase.

#!/usr/bin/env/python

import pulsectl

if __name__ == '__main__':
    with pulsectl.Pulse('test-pulse') as pulse:
        while True:
            pulse.get_peak_sample(source=None, timeout=0.1)
mk-fg commented 2 years ago

Thank you!