When I use pagestack to move between pages, the memory of device increases.
Please see memory increase when use PageStack to see more clearly my problem
Related
I'm trying to simulate a medium size city's traffic and keep surpassing the memory capacity of 512M. Is there anyway to increase the memory? Thank you!!
You can increase the maximum memory by going to your simulation properties as shown below:
I can't find how to determine how much memory is in use by individual objects.
Using Xcode's visual memory debugger, the memory shown on the right side (circled red) is not how much memory the object is actually using.
Xcode allocation instruments seems to only show the entire heap and memory used by individual allocations, not objects as a whole.
Am I missing something? Is there anyway to see how much aggregated memory is used by individual objects?
When a GameScene has been presented, there are two categories which constantly increase in number of persistent#: '_NSArrayM' and 'CAMetalDrawable'. Which results in memory consumption to increase at roughly 0.1 MB every 20 seconds. However, when I set SKView.isPaused = true, memory consumption stops increasing. Is this normal or even bad?
Additionally, how can I clear the persistent data?
If you're still looking for a solution, I had a similar issue.
If you edit scheme and disable Metal API Validation and GPU frame capture, it seemed to fix it for me.
What ranges could be considered Low, Medium, and High in memory usage?
As my app becomes more complex, I notice this number getting higher. I've been trying to use this number as an indicator to how efficiently I'm coding but I've realized I have no bar to compare it with.
How to understand Memory Usage says 1024 Mb to an iPhone/iPad, but obviously all of this memory can't go to the app.
You could get(a pretty nice) overview from this SO question. It won't show you low-medium values, but if you know the limit you can adjust below limit.
If you are near the limits in some view - override didReceiveMemoryWarning and dispose resources accordingly.
My advise is to test always on device, as simulator need a lot memory just because of it's architecture and it's not relative to real devices.
When watching the debug graph in xcode 6 (and probably 5 too), when running my application the memory use continues to rise as I place more of a certain object on the screen and animate it's movement. It does not seem to decrease when I remove it. Once removed I believe there are no more references to them.
See screenshot:
http://i.stack.imgur.com/SnhbK.png
However when I use Instruments to try to identify what's going on, there's only around 12mb persisting, and Total Bytes continues to rise, as expected.
See screenshot:
http://i.stack.imgur.com/VBwce.png
Is this normal behaviour? What exactly is the graph in Xcode showing? Am I overlooking something?
In Instruments I have Allocation Lifespan set to All Allocations and Allocation Type set to All Heap and Anonymous VM for the screenshots above.
UPDATE
By running Instruments with Activity Monitor I was able to see that the "Real Memory" was increasing at the same rate as is displayed in Xcode. #Mark Szymczyk pointed out that OpenGL ES Texture memory allocations are not shown in the Allocations instrument.
By purging the texture cache with the following command in Cocos2D 3.1 at regular intervals, memory use consistently drops back down to around 18mb and begins increasing again as I add more sprites.
[[CCDirector sharedDirector] purgeCachedData];
Credits go to Mark Szymczyk for pointing me in this direction - thanks!
Looking at your screenshots, the Xcode graph is probably showing the equivalent of the Total Bytes column in your Instruments screenshot. When you remove an object, the persistent bytes will decrease, but the total bytes won't. That would explain why the memory use never goes down in the Xcode graph.
The Persistent Bytes column in Instruments is what you should be looking at to determine your app's memory usage.