Windows api projection memory leak

Viewed 64

I'm pretty new to Rust, and was playing around with the windows runtime crate, as I saw something that looks like a memory leak.

When I run this code (I left here only what matters):

use windows::Media::Control::GlobalSystemMediaTransportControlsSessionManager as SessionManager;

fn main() {
    while true {
        let manager = futures::executor::block_on(SessionManager::RequestAsync().unwrap()).unwrap();
    }
}

Every 5 seconds (more or less) the RAM usage grow by a whole MB!

Is there something I'm doing wrong?

UPDATE:

I opened an issue on Windows runtime's github project

1 Answers

From checking the docs, RequestAsync states that it returns a new instance of the Session Manager every time it's called.

Since this is in a while true, I think you're just creating more and more SessionManagers. Perhaps you meant to do this in an async context instead?

Related