-
-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Texture2D memory leak #635
Comments
I'm having an issue that I believe is related when calling get_screen_data() in my render loop (for image saving per frame). Not fixed in 0.4.4 yet. |
This is a problem in my project as well, I'm making a pixel art game, but I still want the window resizable, so every frame I'm creating a render_target and a Camera2D every frame, with the current resolution. |
I also have this issue. Here is a minimal reproducer: use macroquad::prelude::*;
#[macroquad::main("Texture test")]
async fn main() {
let texture_size: u32= 64 * 16;
loop {
let render_target = render_target(texture_size, texture_size);
next_frame().await;
}
} Another user on Mac claims the issue does not happen for them, suggesting it may be platform-specific. In my case, I am on Windows 10. |
I can confirm the bug is still present on HEAD. I have tested with: [package]
name = "texture-memory"
version = "0.1.0"
edition = "2021"
[dependencies]
macroquad = { git = "https://github.com/not-fl3/macroquad.git", branch = "master" } |
Here is a dhat heap profile of the above program: https://gist.github.com/mandroll/02b19220221bc81a1f83d2d299914a32 |
I'm getting this exact same problem with initializing a |
Despite the bug, allocating textures and especially render targets each frame would never work really well. Its a really expensive procedure and there are so many things that could go wrong with that approach. Not like this bug is not worth to be fixed or anything, just a side note :) |
Thanks! I made a mistake in my implementation originally that gave me the false impression that |
Is there a way to resize a previously created RenderTarget? |
* Fix issue with Audio leaking memory when loaded by adding a drop impl, reported in issue not-fl3#628 * Fix issue with Font Atlas leaking memory by adding a drop impl, reported in issue not-fl3#627 * Fix issue with RenderTarget leaking memory by adding a drop impl, reported in issue not-fl3#635
* Fix issue with Font Atlas leaking memory by adding a drop impl, reported in issue not-fl3#627 * Fix issue with RenderTarget leaking memory by adding a drop impl, reported in issue not-fl3#635
* Fix issue with Font Atlas leaking memory by adding a drop impl, reported in issue not-fl3#627 * Fix issue with RenderTarget leaking memory by adding a drop impl, reported in issue not-fl3#635
* Fix issue with RenderTarget leaking memory by adding a drop impl, reported in issue not-fl3#635
* Fix issue with RenderTarget leaking memory by adding a drop impl, reported in issue #635
It doesn't seem to leak from just loading the textures now. However, it seems the leaks still happens when I believe that is because the texture atlas ends up holding #[macroquad::main("Leak?")]
async fn main() {
loop {
let t = load_texture("texture.png").await.unwrap();
build_textures_atlas();
next_frame().await;
}
} |
In
macroquad v4.3.23
Texture2D
types are never removed from memory.Memory steadily grows until system crash when repeatedly converting an
Image
into aTexture2D
in a loop. Even though theTexture2D
is dropped at the end of each loop.Memory does not grow when the
macroquad
program is closed or myImage
s are never converted toTexture2D
sPer #421 (comment), is this issue fixed but just not pushed to a crates.io release yet?
The text was updated successfully, but these errors were encountered: