iOS Memory Deep Dive
iOS Memory Deep Dive
didReceiveMemoryWarning( )
- Don’t necessarily assume that a memory warning is your cause.
The warning will occur when user gets a call, message, etc.
Be careful when you delete a cache in the didReceiveMemoryWarning( )
Access the compressed dictionary → Decompress the dictionary (Memory Increased) → Delete the data
Result: Same allocations (Compressed Dictionary = Updated Dictionary)
Memory resource exception
- Virtual memory regions allocated in a process
- Objects that are allocated, but no longer referenced
- Objects allocated on the heap
- Useful for identifying large object in memory and what allocated it
- Backtraces for malloc and anonymous VM region allocations
- Stop using UIGraphicsBeginImageContextWithOptions
- Using UIGraphicsImageRenderer (iOS 10)
Automatically picks best graphics format !
- ImageIO can read image sizes and metadata information without dirtying memory
- ImageIO can read resize images at cost of resized image only