-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid FlxBackdrop matrix leak #426
Conversation
mid pr 🥱 |
I also found a leak in backdrop so i may add it here if you didn't already can I get simple steps to reproduce the leak(s)? |
FlxMatrix is a pretty cheap class to create so you have to get to some huge numbers of instances of FlxBackdrops for it to affect on memory even a bit, but still its slightly better to have the matrix cached rather than creating new instances. |
I think you missed this part, @MaybeMaru :
|
I like to avoid instance points/rects in favor of local function get/put calls, for many reasons, this was the change I had made last week: #427 FWIW: after profiling I found that matrix instances were a tiny part of garbage collection in my tests, a majority of these instances were from openfl classes and we have very little control over those. but nonetheless, this should still help |
aight looks good |
Creates a FlxMatrix and FlxPoint variable at the start to prevent creating a FlxMatrix and getting a FlxPoint from the pool every frame on drawComplex.
Also makes sure to put back to the pool the points used for blitting.