Help, unable to reduce memory allocation
Hi all,
I am really struggling to understand what is going on. In my game when I play level performance is great. Game is working perfectly. Frame rate is great also. But memory is allocating pretty fast and GC is not releasing it soon enough to avoid FPS drop. So after every 2 minutes of play memory grows for about 40 MB and then GC collect it and frame rate drops heavily. I do not understand why GC does not collect it sooner and instead it waits for memory to grow 40 MB and then collects it. But when GC finaly release so much memory FPS drop heavily for a second and it makes game pause for a second and is really annoying.
You can see here how this level looks like when I am playing it on iPhone:
https://www.youtube.com/watch?v=fkna3mlJU70
(Though game play from that video is not the gameplay from this Scout profile but is the same level, just for the reference).
I have created new Scout profile now with full game play where everything is running Starling, Box2d and StardustParticleSystem.
So here is what to look at this new profile:
1) At around 3:55 on the timeline I have lost life for the last time since I have started playing level. (When I lost life I trigger System.pauseIfGCIsImminent so memory is cleared and do not look at te big deallocation at 3:55 frame 12 725) because that is fine all memory from game play is cleared. After I lost that life and memory is cleared I stopped controlling the game. Which means that no starling display object is hidden or shown, not display object is created, no physics object is create anything. Game is just running but, the ball is standing still and all the objects are still there (except for ones that I have collected).
2) The problem is what happens after 3:55 so look from the frame 12 726 - 18 998 (3:55 - 5:40 on the timeline). In those frames I am not controlling the ball nothing new is being created (not display nor physics object). Box2d is running, Starlng is also running and memory keeps growing. In Starling stats I am seeing memory goes from 150 MB to 190 MB and on the frame 18 999 GC starts clearing memory. And GC clears all the 40-50 megabytes there is no memory leak. By looking at that frame where GC clears memory I do not see anything big so I do not understand where is all the memory that was shown in Starling stats?
3) And that cycle repeats again from frame 19 000 - 24 458 and is the same story I am not controlling the ball I am not creating any new objects its just Box2d and Starling running.
Can you, by looking at that Scout profile tell where are all the megabytes that Starling stats and System.totalMemory is showing?
Thanks,
Caslav
