ggez: memory leak (probably command encoders not getting cleaned up)
Describe the bug Meshes are not cleaned up after they go out of scope
To Reproduce Create a Mesh and drop it
Expected behavior The mesh should be dropped on the GPU
Screenshots or pasted code Adapted from the “super_simple” example
use ggez::{
event,
glam::*,
graphics::{self, Color},
Context, GameResult,
};
use log::LevelFilter;
use simplelog::{ColorChoice, TermLogger, TerminalMode};
struct MainState {}
impl event::EventHandler<ggez::GameError> for MainState {
fn update(&mut self, _ctx: &mut Context) -> GameResult {
Ok(())
}
fn draw(&mut self, ctx: &mut Context) -> GameResult {
let mut canvas =
graphics::Canvas::from_frame(ctx, graphics::Color::from([0.1, 0.2, 0.3, 1.0]));
let circle = graphics::Mesh::new_circle(
ctx,
graphics::DrawMode::fill(),
vec2(0., 0.),
100.0,
2.0,
Color::WHITE,
)?;
canvas.draw(&circle, Vec2::new(0., 380.0));
canvas.finish(ctx)?;
Ok(())
}
}
pub fn main() -> GameResult {
TermLogger::init(
LevelFilter::Info,
simplelog::Config::default(),
TerminalMode::Stdout,
ColorChoice::Auto,
)
.unwrap();
let cb = ggez::ContextBuilder::new("super_simple", "ggez");
let (ctx, event_loop) = cb.build()?;
let state = MainState {};
event::run(ctx, event_loop, state)
}
Hardware and Software:
- ggez version: 0.8.1
- OS: Archlinux
- Graphics card: Nvidia RTX 3070
- Graphics card drivers: nvidia proprietary driver, version 520.56.06, from nvidia-all
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 15 (11 by maintainers)
I ran this, passing in 10 and 100 as an argument, with valgrind, which returned the following
With 10
With 100
So whatever’s going on doesn’t seem to scale with the number of meshes dropped, at least on my machine.