flixel icon indicating copy to clipboard operation
flixel copied to clipboard

Better bitmap keying for FlxText

Open Geokureli opened this issue 11 months ago • 6 comments

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?

Geokureli avatar Mar 13 '24 19:03 Geokureli

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

moxie-coder avatar Mar 13 '24 23:03 moxie-coder

HaxeFlixel/flixel-addons#393

no that seems unrelated

Geokureli avatar Mar 14 '24 04:03 Geokureli

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

superpowers04 avatar Mar 17 '24 07:03 superpowers04

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?

Geokureli avatar Jun 12 '24 18:06 Geokureli

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

superpowers04 avatar Jun 13 '24 15:06 superpowers04

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

Geokureli avatar Jun 13 '24 16:06 Geokureli