Not sure exactly where this goes. When compiling to html5, my program has a memory leak. By commenting out lines of code, I have 100% concluded that it is this function:
function draw() {
graphics.clear();
graphics.beginFill(0x000000, 0);
graphics.drawRect( -Settings.GRID_CELL_SIZE / 2, -Settings.GRID_CELL_SIZE / 2, Settings.GRID_CELL_SIZE, Settings.GRID_CELL_SIZE);
//color and size are member variables of the class this function is in
graphics.beginFill(color);
graphics.drawRect( -size / 2, -size / 2, size, size);
}
This is the draw function for a Tile, so the function is called around 25 times a frame in my case. Commenting out the last two lines (besides the bracket) fixes the issue, as does compiling to any other target.
I have already tried updating all of my libraries, as well as haxe itself from 3.3.0. Calling graphics.endFill() after drawing does not help. I am hesitant to ask for help as I haven’t been able to reproduce the issue outside of my game, but I can’t think of a reason why this code might cause a memory leak. Any ideas?