iphone - Xcode Allocations Instrument - Listening to Memory Warnings -



iphone - Xcode Allocations Instrument - Listening to Memory Warnings -

i using allocations instrument enhance performance of app. want pay attending memorywarnings create sure app doesn't utilize much memory or crash.

i entire app hear memorywarings. know can utilize hear warnings, code below hear everything? also, need implement it? need set in each view controller or can set in app delegate?

- (id)init { if ((self = [super init])) { _cache = [nsmutabledictionary new]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(memorywarning:) name:uiapplicationdidreceivememorywarningnotification object:nil]; } homecoming self; }

i know need implement method listens memorywarnings. hear memorywarnings? also, need place in every viewcontroller? or can place somehow in appdelegate?

- (void)memorywarning:(nsnotification*)note { [_cache removeallobjects]; }

any guidance great! give thanks you!

your view controller have method hear memory warnings

- (void)didreceivememorywarning { // releases view if doesn't have superview. [super didreceivememorywarning]; // release cached data, images, etc aren't in use. }

iphone ios objective-c xcode memory-management

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -