darthdeus / comfy

Comfy is a fun 2D game engine built in Rust. It's designed to be opinionated, productive, and easy to use.

Home Page:https://comfyengine.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Memory leak for simple scene with no setup or update (misunderstanding of make_context)

nokola opened this issue · comments

Windows OS

  1. I removed all setup and update code.
  2. Ran a comfy game on windows.
fn setup(_c: &mut GameContext) {}

fn update(c: &mut GameContext) {}

Expected: no mem use growth

Actual: mem use growing past 1GB in ~20 seconds:

image

image

Turns out is due to my code initializing gilrs in make_context. I assumed make_context is called once not every frame. I propose to clarify that since it can easily be source of a problem. Perhaps calling it make_context_per_frame would really make it obvious and thus less likely to make the same mistake I did/improve ergonomics.