In Cocoa (and other frameworks that derive from NeXTSTEP), dealloc is the instance method responsible for tearing down an object. It should release the object's references to its ivars and then call up to the superclass's implementation.
Questions tagged [dealloc]
496 questions
6
votes
2 answers
An Objective-C message was sent to a deallocated object (zombie) at address: 0x75d52a0
I am relatively new to iOS development so appreciate your help in finding out the root cause for the error that I encountered.
I tried to debug the error using Instruments (i.e. Allocations-Zombie Profiler) but I could not make sense of the call…
![](../../users/profiles/1881383.webp)
user1881383
- 61
- 1
- 4
5
votes
6 answers
Very strange behaviour of dealloc - not getting called
I have tested my all viewControllers dealloc methods. And all of them getting called properly on calling popViewControllerAnimated.
But only 1 controller's dealloc method not getting called. I am not able to figure out the issue.
While pushing to…
![](../../users/profiles/213532.webp)
Tariq
- 9,514
- 11
- 55
- 97
5
votes
3 answers
premature dealloc in ARC based app
I have a problem that seems to be a premature release of an in-use object in an ARC based app. I'm trying to create a folder on an FTP server. The relevant parts of code are below; i'll describe the problem first.
problem with the code is, that the…
![](../../users/profiles/491079.webp)
m Jae
- 715
- 2
- 8
- 20
5
votes
2 answers
removeObserver:forKeyPath: in dealloc
If my instance is observing some property of another object, am I supposed to call removeObserver:forKeyPath: in dealloc?
![](../../users/profiles/74415.webp)
cfischer
- 23,024
- 36
- 125
- 209
5
votes
2 answers
NSKeyedArchiver.archivedData does not work in Swift 3 iOS
When try to encode my custom object in iOS swift get this error from Xcode 8.3
unrecognized selector sent to instance 0x60800166fe80
*** -[NSKeyedArchiver dealloc]: warning: NSKeyedArchiver deallocated without having had -finishEncoding called on…
![](../../users/profiles/3319132.webp)
reza_khalafi
- 5,427
- 4
- 44
- 70
5
votes
3 answers
key value observers were still registered with it when controller is deallocated
I added an observer in the code and then removed it in dealloc and viewWillDisappear but still i am getting an error stating
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x167e5980 of
…
![](../../users/profiles/800910.webp)
Sudhanshu Gupta
- 2,005
- 3
- 30
- 67
5
votes
3 answers
Reduce the amount of time to release 1 million + objects while popping out VC
The current iOS app that we have has to download more than a million objects from the server and we keep it in an array for certain purposes. When the user is done with this functionality and the app takes a while to go back to the previous screen…
![](../../users/profiles/909110.webp)
Vinny
- 227
- 2
- 10
5
votes
0 answers
UISplitViewController: Deinit DetailView in collapsed mode
I've been struggling on this for a while now, but I wasn't able to find a solution:
I've got an iOS 9 app that supports all device families, uses size classes and is programmed with Swift 2.0.
I'm using a UISplitViewController and everything works…
![](../../users/profiles/2872722.webp)
croX
- 1,605
- 1
- 17
- 23
5
votes
4 answers
Objective-C: Do you have to dealloc property objects before deallocating the parent object?
Let's say I have an object named "foo" with another object named "bar" as property.
When "foo" deallocates, will it automatically remove all references to "bar" so that "bar" deallocates as well? or will "foo" deallocate and "bar" float in memory…
![](../../users/profiles/387985.webp)
Marnix v. R.
- 1,558
- 3
- 21
- 32
5
votes
3 answers
SKScene Fails to deallocate memory resulting in bounded memory growth
I have been struggling with this for days, for some reason my SKScenes are not deallocating correctly, this results in bounded memory growth as each time i exit and enter a scene the memory jumps up. This means after say 10 rounds of the game the…
![](../../users/profiles/1447834.webp)
SmokersCough
- 957
- 7
- 22
5
votes
2 answers
iOS - viewController dealloc method not called after popping to previous viewController
In iOS, I pop from current viewController into previous one, but it doesn't go into dealloc.
Is this because there is another pointer pointing towards the current viewController, either in a different viewController or in the current one?
This is…
![](../../users/profiles/2731974.webp)
Operative
- 139
- 1
- 2
- 10
5
votes
4 answers
UIViewController -dealloc method not called
I am working with Automatic Reference Counting.
I have a custom UIViewController subclass and whenever I call -presentViewController: animated:completion: or remove its view from the superview I would like to NSLog something like "I am dealloced"…
![](../../users/profiles/1066899.webp)
the_critic
- 12,014
- 19
- 60
- 109
5
votes
2 answers
iphone app with multiple views/subviews: memory is not being deallocated
I have an iPhone application that loads succesive views in a framework based on the one explained in this link (basically a main ViewController that loads/removes additional views with a displayView method). In my application I am using NIBs (the…
![](../../users/profiles/160933.webp)
mga
- 1,879
- 1
- 21
- 31
4
votes
2 answers
Under Automatic Reference Counting (ARC), where do I put my free() statements?
In cocoa, ARC frees you of having to worry about retain, release, autorelease, etc. It also prohibits calling [super dealloc]. A -(void) dealloc method is allowed, but I'm not sure if/when it's called.
I get how this is all great for objects,…
![](../../users/profiles/34820.webp)
Olie
- 23,933
- 18
- 92
- 129
4
votes
1 answer
Getting "deallocated while key value observers were still registered with it." errors after conversion to ARC
I am using this class:
https://github.com/alexleutgoeb/ALPickerView
Since I converted to ARC, I get this error after clicking on the pickerview a couple of times:
2011-10-18 14:10:19.424 MappingApp[3398:10d03] An instance 0x73c7cd0 of class…
![](../../users/profiles/925454.webp)
Aaron
- 71
- 1
- 1
- 7