nannou icon indicating copy to clipboard operation
nannou copied to clipboard

draw.text() memory leak

Open timpauli opened this issue 3 years ago • 3 comments

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.

timpauli avatar Aug 17 '21 10:08 timpauli

Possibly related to #761 though yet to confirm.

mitchmindtree avatar Aug 17 '21 17:08 mitchmindtree

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

timpauli avatar Aug 18 '21 10:08 timpauli

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

shastro avatar Mar 17 '23 04:03 shastro