Problem : On native targets openfl TextField allocates memory as the text increments this is also exposed on haxe flixel FlxText because it extends openfl TextField.
Reproducing: Creating a simple flixel app and adding a textfield that displays an incrementing integer will show it both at the flixel level or in an openfl textfield.
Author: 47rooks
import flixel.FlxG;
import flixel.FlxState;
import flixel.text.FlxText;
import openfl.text.TextField;
import openfl.text.TextFormat;
class PlayState extends FlxState
{
var _textF:FlxText;
var _textStr:String;
var _myInt:Int;
var _firstDone:Bool;
var _oflText:TextField;
override public function create()
{
super.create();
_myInt = 0; // Counter to increment
_textStr = Std.string(_myInt);
_textF = new FlxText(20, 100, 200, _textStr, 20);
add(_textF);
_oflText = new openfl.text.TextField();
_oflText.selectable = false;
_oflText.text = _textStr;
_oflText.defaultTextFormat = new TextFormat(null, 14, 0xffffff);
FlxG.game.addChild(_oflText);
}
@:access(flixel.system.frontEnds.BitmapFrontEnd)
override public function update(elapsed:Float)
{
super.update(elapsed);
_myInt++;
// Uncomment for a flixel level test
// _textF.text = Std.string(_myInt);
// Check cache size
var numEntries = 0;
for (k in FlxG.bitmap._cache.keys())
{
numEntries++;
}
trace('FlxG.bitmap._cache numEntries=${numEntries}');
// Update the OpenFL text - comment out to run the flixel only test```
_oflText.text = Std.string(_myInt);
}
}
TextField Memory Leak on CPP and HL
Ver: 9.2.x
Problem : On native targets openfl TextField allocates memory as the text increments this is also exposed on haxe flixel FlxText because it extends openfl TextField.
Reproducing: Creating a simple flixel app and adding a textfield that displays an incrementing integer will show it both at the flixel level or in an openfl textfield.
Author: 47rooks