HaxeFlixel / flixel

Free, cross-platform 2D game engine powered by Haxe and OpenFL
https://haxeflixel.com/
MIT License
1.97k stars 434 forks source link

Better bitmap keying for FlxText #3081

Open Geokureli opened 6 months ago

Geokureli commented 6 months ago

source: https://github.com/HaxeFlixel/flixel/blob/dev/flixel/text/FlxText.hx#L893 FlxText bitmaps are keyed by their text, this seems like it would generate a lot of bitmaps unnecessarily. ideally we would generate a new bitmap if the dimensions of a textfield change, without having different fields of the same size use the same bitmap. maybe we can use ID, or get some kinda mem address?

moxie-coder commented 6 months ago

is this to address this old issue? https://github.com/HaxeFlixel/flixel-addons/issues/393

Geokureli commented 6 months ago

HaxeFlixel/flixel-addons#393

no that seems unrelated

superpowers04 commented 6 months ago

On an semi-related note, the current method also causes a memory leak whenever you try to edit a FlxText. I believe it's somehow not disposing of graphics or something. I tried just using the existing key and the memory leak went away however all of the FlxText's broke for obvious reasons

Geokureli commented 3 months ago

On an semi-related note, the current method also causes a memory leak whenever you try to edit a FlxText. I believe it's somehow not disposing of graphics or something. I tried just using the existing key and the memory leak went away however all of the FlxText's broke for obvious reasons

Do you have a decent way to reproduce this memory leak?

superpowers04 commented 3 months ago

On an semi-related note, the current method also causes a memory leak whenever you try to edit a FlxText. I believe it's somehow not disposing of graphics or something. I tried just using the existing key and the memory leak went away however all of the FlxText's broke for obvious reasons

Do you have a decent way to reproduce this memory leak?

In my experience, it happens whenever I change the text field of an FlxText. I don't really have the time to make a reproducible test because it takes an absurd amount of time for a new Flixel project to compile

Geokureli commented 3 months ago

In my experience, it happens whenever I change the text field of an FlxText.

how are you measuring memory?

I don't really have the time to make a reproducible test because it takes an absurd amount of time for a new Flixel project to compile

it compiles immensely faster if you target something other than native desktop, I typically use HTML5 for testing, many use HL which is lightning fast