amethyst / bracket-lib

The Roguelike Toolkit (RLTK), implemented for Rust.
MIT License
1.54k stars 111 forks source link

Memory usage goes up rapidly after resizing window #262

Open ot2t7 opened 2 years ago

ot2t7 commented 2 years ago

Hello,

After I resize a window created by RLTK, the process begins to use up more memory, and the memory doesn't seem to ever go back down. It doesn't really matter if I shake the window around or slightly adjust the size as a regular user would, the memory still goes up. I've attached a .gif which shows this behavior. bracket-lib-memory

How to reproduce:

main.rs:

use rltk::{GameState, Rltk, RltkBuilder};
struct State {}

impl GameState for State {
    fn tick(&mut self, ctx: &mut Rltk) {
        ctx.print(1, 1, "Hello world!");
    }
}

fn main() -> rltk::BError {
    let game_state = State {};

    let context = RltkBuilder::simple80x50().with_title(" ").build()?;
    rltk::main_loop(context, game_state)
}

Cargo.toml:

[package]
name = "roguelike"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rltk = { version = "0.8.0" }

My system information:

Operating System: Artix Linux KDE Plasma Version: 5.24.4 KDE Frameworks Version: 5.92.0 Qt Version: 5.15.3 Kernel Version: 5.16.16-artix1-1 (64-bit) Graphics Platform: X11 Processors: 6 × Intel® Core™ i5-9400F CPU @ 2.90GHz Memory: 15.5 GiB of RAM Graphics Processor: NVIDIA GeForce GTX 1660 SUPER/PCIe/SSE2 Rustc Version: rustc 1.59.0 (9d1b2106e 2022-02-23) Cargo Version: cargo 1.59.0 (49d8809dc 2022-02-10)

scambier commented 2 years ago

It's almost certainly related to https://github.com/amethyst/bracket-lib/issues/224

Last time I checked when I said it was fixed, I remember it was actually rising like in your example. I considered it fixed because as you can see, the ram usage you're showing is very far from what it used to be, and so is not really a problem anymore. Unless you resize your window non-stop for 20 minutes, at which point you deserve a crash anyway 🤷‍♂️