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

Memory leak in AnimatedSprite ? #12

Closed
Oxey405 opened this issue Nov 6, 2023 · 3 comments
Closed

Memory leak in AnimatedSprite ? #12

Oxey405 opened this issue Nov 6, 2023 · 3 comments

Comments

@Oxey405
Copy link

Oxey405 commented Nov 6, 2023

Hello @Whitebrim !
I am using AnimatedSprite for a game I am making where there are some sprites (around 30 max) that are animated.
Unfortunately, it look likes there is a memory leak when updating animations every frame... I don't know how specific this is to my code but what I can show you is the stats window of the device (I ran the game on device to check real performances).
Device stats

I have looked into the profiler and determined that this indeed comes from calling updateAnimation() every frame.
One thing though, I am not making a class to create objects, I am just storing objects in a table and I have function that creates them like a class because for some reason Playdate SDK won't allow to extend a class from a class that already is extended from something.

I'll be glad to provide more informations and even contribute to AnimatedSprite. Looking forward to your answer and have a nice day !

@Whitebrim
Copy link
Owner

Do you have problem with fps or with garbage collector running frequently?

@Oxey405
Copy link
Author

Oxey405 commented Nov 6, 2023

Do you have problem with fps or with garbage collector running frequently?

I think both. Really the problem is : memory is slowly eaten away by something (maybe it's not AnimatedSprite but I don't really create new data to memory every frame) and then CG quicks in and slows the game every what... 30 seconds or so ?

@Whitebrim
Copy link
Owner

Do you have problem with fps or with garbage collector running frequently?

I think both. Really the problem is : memory is slowly eaten away by something (maybe it's not AnimatedSprite but I don't really create new data to memory every frame) and then CG quicks in and slows the game every what... 30 seconds or so ?

You should use memory profiler and track down what is deleted by GC. In my endless runner game with target 40 fps I don't get freezes.

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

No branches or pull requests

2 participants