The *Resident* size is presumably all of the memory/pages that the system associates with my App. In my game we can see that it has a *Resident* size of 97.69 MB, and a *Dirty* size of 36.43 MB. Things get interesting with VM Tracker, as it looks to be the most finely grained method for iOS to report an application’s memory usage. Next down the list is the number reported by the VM Tracker (Virtual Memory Tracker) instrument. My game when running pokes in at 28.62 MB, which we’ll note is significantly higher than the 15 MB that Allocations reported. The biggest one I’ve found so far is Infinity Blade by Epic, which peaked in at a hefty 165 MB of memory, or around 1/4 of the available memory on my iPhone 4. One fun thing about the memory monitor is you can see other applications and how much memory they’re using. That number also tends to match the number reported in out of memory crash reports, indeed if you dig around Mach you’ll see the number reported is the number of pages multiplied by the page size. A side note is that this number is the same as what this call returns: kern_return_t kerr = task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&info, &size) Of course it’s pretty much impossible to figure out what’s using it from just the one number… but it’s a start. You name it, it’s yours and counted against you. This seems to include EVERYTHING! Textures, executable, shared libraries, actual allocations. The number that’s usually the most off-putting is the one reported by the Memory Monitor instrument under the Real Memory column. So off to other instruments we go! Memory Monitor And if you’re using MonoTouch or Unity, you might get suspicious about not seeing the C# heap memory being taken into account. And if I swap in TCMalloc or dlmalloc as my allocator, all of a sudden I’m only using 4.3 MB. As a reference in my game if I disable my internal allocator, this shows a pretty stable usage of around 16 MB over 12 thousand allocations.īut wait… where are my textures? I know I’m using some memory for my textures and buffer objects. If you’re using C++ or Objective-C, calls to new or alloc end up falling through to… malloc! So any standard code side allocations will show up here with a callstack to help you track it down, which is pretty handy. The allocations will show you in a reasonably nice way all of the calls your application makes to malloc. If you google for information about memory on iOS, the first recommendation is to look at the Allocations instrument. I’m certainly not an expert here, so take all of it with a few grains of salt. The documentation seems a bit scattered, so most of this post is me documenting my discoveries as I go. On iOS, even figuring out how much memory you’re using is pretty difficult! There’s not too much information available at runtime, and it’s a bit off-putting when I count up the allocations my game has made, and the system reports that it is using 400% more than I expected. Ps I moved your thread to Core OS > Processes because this has nowt to do with Swift.As I get more familiar with iOS, one difference from my experience with consoles is the general mystery about where resources end up in memory.įor consoles a typical game allocates as much memory as it can from the OS, puts it into its own memory pools and then is as miserly as possible from then on. OTOH, if you’re trying to get these statistics for your own app, I don’t see how this new question is any different from the question that started the current thread. Are you trying to get performance statistics for other applications? If so, that’s not possible on iOS. Yeah, I saw your other thread about this and I’m not sure how it’s different from this thread. One more doubt Iam having is that like in android by using package id and adb tool, cpu and memory usage can be found, same way is it possible in iOS? using bundle id or app id. With regards the Anonymous VM values, it’s likely that you can get these using some low-level Mach statistic, but I don’t have an immediate answer for you off the top of my head. You can get heap allocations using malloc_zone_statistics. In Instrument I want All Heap and Anonymous VM values ( from Allocations ).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |