empty class - 50MB memory on chrome. So the default take 50MB
show my mainmenu - 55MB memory on chrome. So my mainmenu take 5MB. Then I call function destroy on mainmenu, which reset / null all variable that I used on mainmenu class. But the memory still at 55MB. It should back to 50MB right? Because when I tried on flash / android my memory goes down back to default.
Or maybe is there any simple project that showing memory goes down? So I’m know I do it correctly or not.
public function new() {
super();
bg = new Bitmap (Assets.getBitmapData("images/bg1.png"));
title = new Bitmap (Assets.getBitmapData("images/title.png"));
addChild(bg);
addChild(title);
addEventListener(MouseEvent.CLICK, destroyMainMenu, false, 0, true);
}
private function destroyMainMenu(e:MouseEvent) {
removeEventListener(MouseEvent.CLICK, destroyMainMenu);
bg.parent.removeChild(bg);
bg.bitmapData.dispose();
bg = null;
title.parent.removeChild(bg);
title.bitmapData.dispose();
title = null;
}
Also I notice a different memory usage of openfl 4.9.2 + lime 4.0.2 vs openfl 5.1.5 + lime 5.2.1.
Openfl 5.1.5 + lime 5.2.1 use memory bigger than old version openfl 4.9.2 + lime 4.0.2.
Here’s the comparison result using same source code