godotengine / godotengine/godot
Animating FontVariations causes memory leak(?)
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
Tested in 4.2.1.stable and 4.3.rc3.
### System information
Godot v4.2.1.stable - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3090 (NVIDIA; 31.0.15.4601) - 11th Gen Intel(R) Core(TM) i9-11900K @ 3.50GHz (16 Threads)
### Issue description
When animating a FontVariation in an AnimationPlayer, ram and vram usage skyrockets. In 4.3.rc3, the Video RAM tab shows a ton of entries for an empty resource: ",Texture,1024x1024x1 LumAlpha8,2.66 MiB". The animation in question simply increased the Y scale of the font and was used so the font outline would have a consistent width as scaling normally seems to make it look a little off. It was semi-inconsistent but at times could increase ram use from 120-ish mb to over _12gb_. This is especially bad when the game is maximised.
### Steps to reproduce
Make a font variation and have it be animated with an AnimationPlayer. In my case it was a 1 second long animation where it starts at a higher y scale and ends at its original y scale, with elastic easing at 60fps.
### Minimal reproduction project (MRP)
[leak.zip](https://github.com/user-attachments/files/16588231/leak.zip)
Contributor guide
Research direction
Start by opening the attached leak.zip minimal reproduction and reproduce the AnimationPlayer animation of a FontVariation while watching RAM and VRAM usage. Trace the FontVariation animation path and the empty 1024x1024 LumAlpha8 resources reported in the Video RAM tab. Done means the reproduction no longer causes unbounded memory growth, with a regression test or documented verification where the relevant engine test coverage permits.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics, game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100