Skip to content
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

Merged
merged 3 commits into from
Apr 13, 2024
Merged

Avoid FlxBackdrop matrix leak #426

merged 3 commits into from
Apr 13, 2024

Conversation

MaybeMaru
Copy link
Contributor

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.

@Unholywanderer
Copy link

mid pr 🥱
would never get merged

@Geokureli
Copy link
Member

Geokureli commented Apr 12, 2024

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)?

@MaybeMaru
Copy link
Contributor Author

MaybeMaru commented Apr 12, 2024

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.
Not sure if thats the leak youre referring to as well though

@Geokureli
Copy link
Member

Geokureli commented Apr 13, 2024

I think you missed this part, @MaybeMaru :

can I get simple steps to reproduce the leak(s)?

@Geokureli
Copy link
Member

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

@MaybeMaru
Copy link
Contributor Author

aight looks good

@Geokureli Geokureli modified the milestones: 3.2.2, 3.2.3 Apr 13, 2024
@Geokureli Geokureli merged commit bc6cd74 into HaxeFlixel:dev Apr 13, 2024
11 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants