Hello community,
I'm trying to debug that I didn't made. This app works online and cache all the contents on the file system saving all the paths(a lot of paths) on memory(wrong approach I see, but I must work on that). This app has an option that make download all the contents and fill the memory with the relative paths.
The problem is that when I check this option the app starts download and caching but before it finishes it crashes. On simulator everything works fine of course.
The crash report log talks about memory warning and app killed by jetsam.
Tracking the app with allocation on instruments I see that the live bytes are "just" around 7Mb, this is also helped by using a flushing mechanism added during download, that releases the old paths after the download is finished.
There are no visible leaks at all.
I started to use VMTracker and I've seen that the resident and dirty memory are pretty high with peaks around 61Mb and 21Mb. There is something that I'm not getting.
I've read a lot of questions about it
What do "Dirty" and "Resident" mean in relation to Virtual Memory?
How can I get rid of resident dirty memory in Objective-C?
But since I'm releasing the most of the paths created where the other dirty memory comes from? and how can I clean it?
Thanks,
Andrea
iOS analysis with VM tracker. Dirty and resident memory cause memory warnings, what should I do?
4.6k views Asked by Andrea At
1
Well, found a solution I guess..doing various tests I've found out that probably connections were caching something. So I've set the NSURLCache 0byte. My application now seems to run with a very few dirty memory, almost a half. A big improvements. Here are the amazing two lines of code.
As spoken I some teck talks of Apple the dirty memory also can represents a data cache, I still didn't tried setting the cache policy in the URL request, but probably the effect will be the same.
Hope to help someone.