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

chg: update webp dependency (MEMORYLEAK) #2034

Closed
wants to merge 1 commit into from

Conversation

cosinusalpha
Copy link

This update of the webp dependency fixes a memory leak when saving images as ".webp".

The memory leak can be easily simulated with the following code:

use image::io::Reader as ImageReader;

const IMAGE: &str = "input.png";
const OUTPATH: &str = "out.webp";

fn main() {
    println!("Hello, world!");


    // do this 1 M times
    for i in 0..1_000_000 {
        println!("{}", i);
        let img = ImageReader::open(IMAGE).unwrap().decode().unwrap();

        // save image as webp
        img.save(OUTPATH).unwrap();
    }
}

I license past and future contributions under the dual MIT/Apache-2.0 license,
allowing licensees to choose either at their option.

@fintelia
Copy link
Contributor

Thanks for raising this. In Cargo.toml, version = "0.2.2" actually means version = "^0.2.2", i.e. any version 0.2.x where x>=2. You should be able to pull in the newer version of libwebp by running cargo update.

What this means is that bumping to semver compatible versions in our Cargo.toml doesn't do anything. Users would have to do an update to get the newer version of this crate, at which point they'd end pull in the newer libwebp at the same time (regardless of whether our Cargo.toml changed).

@fintelia fintelia closed this Oct 21, 2023
@cosinusalpha
Copy link
Author

Thanks for the quick reply!

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

Successfully merging this pull request may close these issues.

2 participants