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 issues when presenting new SKTiledScene, small on iOS, larger on macOS #43

Open
ghost opened this issue May 6, 2022 · 0 comments

Comments

@ghost
Copy link

ghost commented May 6, 2022

When presenting a new scene it appears not all memory is freed.

The Demo project shows this, when repeatedly pressing "next" cycling through the maps, memory usage goes up, and never down. On the iOS Simulator I see ± 1MB increased memory used each time, on macOS I see ±5MB of increased memory use each time. The memory graph never goes down.

When trying my own app, with a single TMX file (eg. the famous level1.tmx file from this example) I get 100 MB (!) of increased memory use on macOS and 2 MB on iOS Simulator every time a new SKTiledScene is presented with that map.

When trying with an empty TMX map of size 10x10 tiles with no content, I get 120 MB of increased memory use on macOS and 0.2 MB on iOS Simulator every time a new SKTiledScene is presented.

It appears to me that on macOS the problem is huge, on iOS it is doable

The SKTiledScene.deinit gets called each time so the scene is cleaned up correctly (I think?)

When debugging with Xcodes memory graph it shows no problems or leaks. However, if I don't load a map with SKTiledScene.setup(....) the issue does not occur.

When I override deinit in all classes and print a debug text, I can see that only SKTilemapParser gets deinited immediately after loading the map. All other classes are never deinited.

@ghost ghost changed the title Memory leak when presenting new SKTiledScene, small on iOS, larger on macOS Memory issues when presenting new SKTiledScene, small on iOS, larger on macOS May 6, 2022
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

0 participants