In Multitasking and PiP for iOS 9, the apps are suggested to be good multitasking citizen in order to keep the best user experience even in a resource constrainted environment. This session aims to provide useful information for adopting new multitasking features.
Sample Code : iconReel
Great Performance is a trade-off between memory, CPU, Disk space, I/O and GPU.
Working Set is a set of objects and resources is required right now
dispatch_sync()
and dispatch_block_wait()
Occured when
API for indicating memory warning
-[UIApplicationDelegate applicationDidReceiveMemoryWarning:]
-[UiViewController didReceiveMemoryWarning]
UIApplicationDidReceiveMemoryWarningNotification
DISPATCH_SOURCE_TYPE_MEMORYPRESSURE
NSPurgeableData
beginContentAccess
considered as dirtyendContentAccess
considered as purgeableisContentDiscarded
has memory been reclaimedFile data characteristics
Maximize clean memory
* Data in a file can be "memory mapped" (not caching the whole file in the memory but a pointer to a location of the file location)
* memory and file content must be match exactly so it is useful for read-only data
* Data can be removed and reload when needed
API for memory mapped
typedef NS_OPTIONS(NSUInteger, NSDataReadingOptions) {
NSDataReadingMappedIfSafe,
NSDataReadingMappedAlways,
};
@interface NSData (NSDataCreation)
- (nullable instancetype)initWithContentsOfFile:(NSString *)path
options:(NSDataReadingOptions)readOptionsMask
error:(NSError **)errorPtr;
@end