Objects drawn to end of application: no dealloc okay?

I do not clear single objects that live the life of the application in dealloc . Is there any reason I should?

 - (void) dealloc { // never deallocs [super dealloc]; } 

I seem to assume that I have enough wall iOS to clear all the memory of the application when it ends. Is it correct?

+4
source share
1 answer

Yes, when your application is completed, your virtual memory address space of your application will be completely erased / freed. You can fill in -dealloc if you want, but it will never be called, so the only advantage for this is that if you decide to make your object non-single using the track, you have a dealloc method already exists.

It should be borne in mind that any singleton (which will exist throughout the life of your application) that has any cache that can reach a large size should register for UIApplicationDidReceiveMemoryWarningNotification and reduce or reset the cache when necessary, when it appears memory warning.

+8
source

Source: https://habr.com/ru/post/1339910/


All Articles