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 leak in WASAPI input_devices #802

Open
nicolaiunrein opened this issue Oct 13, 2023 · 0 comments
Open

Memory leak in WASAPI input_devices #802

nicolaiunrein opened this issue Oct 13, 2023 · 0 comments

Comments

@nicolaiunrein
Copy link

The below code is causing a memory leak on my machine:

use cpal::traits::HostTrait;

fn main() {
    let host = cpal::ALL_HOSTS
        .into_iter()
        .find(|id| id.name() == "WASAPI")
        .and_then(|id| cpal::host_from_id(*id).ok())
        .expect("No WASAPI host found");

    loop {
        let _ = host.input_devices().unwrap().collect::<Vec<_>>();
        std::thread::sleep(std::time::Duration::from_millis(10));
    }
}

System Info

  • OS: Running Microsoft Windows 11 Pro
  • Version: 10.0.22621 Build 22621
  • cpal version: 0.15.2
  • Toolchain: stable-x86_64-pc-windows-msvc

rustc -Vv output

rustc 1.72.0 (5680fa18f 2023-08-23)
binary: rustc
commit-hash: 5680fa18feaa87f3ff04063800aec256c3d4b4be
commit-date: 2023-08-23
host: x86_64-pc-windows-msvc
release: 1.72.0
LLVM version: 16.0.5
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

1 participant