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

draw.text() memory leak #786

Open
timpauli opened this issue Aug 17, 2021 · 3 comments
Open

draw.text() memory leak #786

timpauli opened this issue Aug 17, 2021 · 3 comments

Comments

@timpauli
Copy link

Hi,

when I use draw.text() my nannou app starts to consume endless memory. That means the memory usage grows and grows until all the memory of my ram is gone. I am on Ubuntu 21.04 with Rust 1.54 and Nannou 0.17.

Here is a minimal example where the bug appears:

use nannou::prelude::*;

fn main() {
    nannou::app(model).update(update).simple_window(view).run();
}

struct Model {}

fn model(_app: &App) -> Model {
    Model {}
}

fn update(_app: &App, _model: &mut Model, _update: Update) {}

fn view(_app: &App, model: &Model, frame: Frame) {
    let draw = _app.draw();
    draw.background().color(WHITE);
    let text: &str = "hello";
    draw.text(text).color(BLACK);
    draw.to_frame(_app, &frame).unwrap();
}

What am I doing wrong? Thank you very much.

@mitchmindtree
Copy link
Member

Possibly related to #761 though yet to confirm.

@timpauli
Copy link
Author

As a workaround for now one can use

[patch.crates-io.wgpu]
git = "https://github.com/mitchmindtree/wgpu-rs"
branch = "0.8-as-0.9"

in the Cargo.toml. (downgrade wgpu to 0.8)
Fixes the leak for me.
Thanks a lot to @mitchmindtree

@shastro
Copy link

shastro commented Mar 17, 2023

It seems like this has been fixed in nannou 0.18.1, should this be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants