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

YYSpriteSheetImage memory issues #38

Merged
merged 2 commits into from
Jun 22, 2016
Merged

YYSpriteSheetImage memory issues #38

merged 2 commits into from
Jun 22, 2016

Conversation

d-zhukov
Copy link

This is a fix proposal for a crash because of lots of unreleased CG raster data (application is unloaded by jetsam).

When we had say 7-10 (or more) animated images on the same page animating at the same time, in instruments we can see that application memory usage is acceptable ~60mb, but "other processes" can be up to 1gb and growing (related to CG raster data). Looks like this issue is caused by the yy_imageByDecoded (YYCGImageCreateDecodedCopy to be more precise). Since animatedImageFrameAtIndex: for a sprite sheet image is the sprite atlas itself, thus whole atlas is copied for every frame of animation (we had 60 frames).

yy_isDecodedForDisplay is always YES for animated images (images.count > 1), so seems reasonable to return YES for a Sprite Sheet Images also.

After this fix 10+ sprite images on the screen are animating at the same time on old gen iPod (iOS 7) without any issues.

@ibireme ibireme merged commit eb13210 into ibireme:master Jun 22, 2016
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.

2 participants