Skip to content

Memory usage of camera bundles #6417

Closed
Closed
@eyzi

Description

@eyzi

Bevy version

0.8.1

Relevant system information

cargo version: cargo 1.64.0 (387270bc7 2022-09-16)
OS: Windows 11 (build 22621.674)

`AdapterInfo { name: "NVIDIA GeForce GTX 980 Ti", vendor: 4318, device: 6088, device_type: DiscreteGpu, backend: Vulkan }`

What you did

Running a bare project with only DefaultPlugins and a camera bundle (tested with both 2d and 3d)

#![windows_subsystem = "windows"]

use bevy::prelude::{App, Camera2dBundle, Commands, DefaultPlugins};

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_startup_system(setup_camera)
        .run();
}

fn setup_camera(mut commands: Commands) {
    commands.spawn().insert_bundle(Camera2dBundle::default());
}

What went wrong

I noticed that the memory usage of my builds (with cargo build --release and without console) is steadily growing. While troubleshooting for the root cause, I ended up just running a bare project (see above code) in which I was able to reproduce the behaviour. It seems like the camera bundles, both Camera2dBundle::default() and Camera3dBundle::default() are using the RAM increasingly with time. Roughly about 8Kb per second of usage growth for Camera2dBundle and 12Kb per second for Camera3dBundle.

When tried without the camera bundles, the memory usage is fairly stable.
When tried with a running game loop, there's not much difference in usage increase, if at all.
In debug, memory usage increases a lot faster.
In release with console, memory usage increases at about the same rate.

Additional information

Brought this up on Discord's help forum and was advised to create an issue as there might be a memory leak somewhere.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screenC-BugAn unexpected or incorrect behaviorC-PerformanceA change motivated by improving speed, memory usage or compile times

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions