![]() Use vmmap and heap to find some objects or regions with big number, use leak to see references between objects, like finding circular reference use malloc_history to see how it is created.MemCleaner is a memory cleaning software with gorgeous interface. So, here comes the malloc_history command. In some cases, we not only want to know the memory size, but also want to know the how it created. Heap App.memgraph -sortBySize | > ~/output.txt Heap command shows the class name in CLASS_NAME column, the num of the class in COUNT column, the average size of the object in the AVG column, the total size in the BYTES column. useful for indentifying large objects in memory adn what allocated it.It not only shows the cycle, but also the root object of the cycle. This command can work with other commands. Here, using malloc_history to see the back trace for this object, we found the related code creating this particular VM memory. By scanning these info, we would find more clues. We can use the start memory address of the last region and search it in the memory graph in XCode. Chance are this later region is more closely tied to whatever caused that memory pike. the later region was created, the later my app’s life cycle it happened. It turns out that vmmap, by default, if it finds contiguous regions, it collapses. Vmmap -verbose mgraph | grep " CG image" | > output.txt So we have to see more infomation of this region by using -verbose option.Īll these commands can work with other shell commands, like redirecting the output stream a output.txt file. The secong CG Image region takes more takes more dirty and swapped memory. There are two regions here, the last row is summary info. Then, we use grep to get more info about CG Image. Here, we find CG Image takes much more memory than others. An example of using vmmap to debug a memory issueįirst, we can use summary info to look for the big numbers in virtual size and swapped size colomn. So we should care more about dirty size and swapped size. swapped size is related to compressed memory. There are virtual size, resident size, dirty size, swapped size columns here.Īccording to this session, we can ignore the virtual size, because it is memory requested by the app, while not neccessarily be used. In general, we should look for the big number for the size. Vmmap helps to show some dirty memory info of your app. ![]() Working with memory graph using commands vmmap providing profiles for dirty and compressed memories.We should mainly focuse on these two part, dirty and compressed memory when analyzing the memory profile. It is the dirty size + the compressed size that the system uses to determine how much memory the app is really using. When decompressing, the used memory will be increased. Caching can reduce the CPU usage and time complexity, but it costs memory. Like, you receiving a phone call while using the App.Īfter removing objects in didReceiveMemoryWarning Maybe because the compressor freeing memory. When you got Memory warning, you App is not always the cause. The system will do the compression and decompression for you by memory compressor. There is no traditional disk swap in iOS Memory compressor Some pages can hold multiple objects, and some objects Memory in use = number of pages x page size Page is typically 16KB in size and operating system gives it to you when your app requests memory. We have to know the differences between them. There are dirty memory, clean memory, compressed memory in iOS system. iOS Memory Deep Dive - WWDC 2018 - Videos - Apple Developer. This is an pretty good session about iOS memory.
0 Comments
Leave a Reply. |