openfl / lime

A foundational Haxe framework for cross-platform development
https://lime.openfl.org/
MIT License
761 stars 376 forks source link

HTML5 memory leak #1862

Closed mikaleerhart closed 1 hour ago

mikaleerhart commented 3 hours ago

Screenshot 2024-11-14 at 5 07 22 PM

I don't really know where to start to look into this. There's no terminal or console warnings. I was using Phaser and am now porting my game over to HaxeFlixel. I ran into a bad memory leak today in my project (a simple object catching game with pngs, spritesheets, fonts, and sounds). It ran all the way up to 150GB in a matter of seconds.

What I've tried: update haxelib, using git versions of lime/openfl/hcxpp, and using different browsers. I'm stumped so I thought I would make this public. Will happily provide private access to my repo if anyone has time to take a look.

Only is happening in the html5 target (tried debug & final options). Memory usage is fine in neko target although my sound wasn't playing which is why I tried html5 in the first place.

barisyild commented 3 hours ago

Do you have a code that can reproduce the problem?

mikaleerhart commented 3 hours ago

Gave you access to my private repo. The memory runs up as soon as you load it in the html5 target.

barisyild commented 3 hours ago

Gave you access to my private repo. The memory runs up as soon as you load it in the html5 target.

I built the game and it works fine.

barisyild commented 2 hours ago

I contacted you on discord.

mikaleerhart commented 2 hours ago

Weird, you're right, I just built it on my old Linux laptop and no memory leak there. It must be my OS/hardware (macOS 15.1, M2 Mac mini). I just tried creating a fresh user account on the Mac, made a new directory for haxelib and installed haxe/lime/openfl/flixel. Ran lime test html5 and the leak is back. I'm keeping this open in case anyone has any ideas or can look into it further.

barisyild commented 1 hour ago

Weird, you're right, I just built it on my old Linux laptop and no memory leak there. It must be my OS/hardware (macOS 15.1, M2 Mac mini). I just tried creating a fresh user account on the Mac, made a new directory for haxelib and installed haxe/lime/openfl/flixel. Ran lime test html5 and the leak is back. I'm keeping this open in case anyone has any ideas or can look into it further.

try to update flixel with haxelib install flixel

mikaleerhart commented 1 hour ago

Ok, It's a combo of my project/hardware/OS. I'm gonna comment out every line of code tomorrow until I find the line that is causing the issue and post here to close the issue.

barisyild commented 1 hour ago

Ok, It's my project. Not happening in any examples. I'm gonna comment out every line of code tomorrow until I find the line that was causing the issue, and post it here & close the issue.

Ok I found the problem, the problem is debug draw can you please start the program without debug and retry?

mikaleerhart commented 1 hour ago

That's it! FlxG.debugger.drawDebug = true; Thank you. Should we close the issue now?

barisyild commented 1 hour ago

That's it! FlxG.debugger.drawDebug = true; Thank you. Should we close the issue now?

I think don't close issue because it is a problem that debug draw causes this.

barisyild commented 1 hour ago

Please create the issue here: https://github.com/HaxeFlixel/flixel/issues

mikaleerhart commented 1 hour ago

Will do.