Memory leak calling get_mut on texture assets resource
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## Bevy version
0.5.0
## Operating system & version
Windows 10
## What you did
I'm trying to dynamically generate textures, and noticed memory usage increases whenever I was updating a texture. Turns out it happens when calling `textures.get_mut` (Thanks to TheRawMeatball on Discord for figuring that out).
## What you expected to happen
The borrowed mutable texture handle should be freed after use.
## What actually happened
Memory usage keeps increasing as the game runs.
## Additional information
I've created a repo with an example (115 LOC): https://github.com/oal/bevy-memory-leak Commenting out line 32 does nothing, but commenting out line 30-33 makes the leak go away, which means something's going wrong in the `get_mut` call.
Contributor guide
Research direction
Start by running the 115-line reproduction in https://github.com/oal/bevy-memory-leak and inspect the code around lines 30–33, especially the textures.get_mut call. Compare memory use with those lines enabled and disabled; done means repeatedly updating the texture no longer causes memory usage to keep increasing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics, game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 57/100