Questions tagged [dealloc]

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.

496 questions
-1
votes
2 answers

Can an Objective-C object's retain count drop below zero?

I have learned manual memory management in Objective-C and every article said: "When the retain count of an object drops to 0, the dealloc method is called and the object is destroyed". And nothing more. But there is no answer for several questions:…
WantToKnow
  • 1,367
  • 2
  • 10
  • 18
-1
votes
2 answers

Class is deallocating while KVOs are still registered

I've been trying to pinpoint the problem but have not been able to do so because it's very hard to reproduce. Here's the error: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x1455c7fa0 of class…
Vee
  • 1,579
  • 1
  • 28
  • 54
-1
votes
1 answer

How to send 'dealloc' message to nil Object in Objective-c?

I know that nil object does not received message. but dealloc is not. exam code is here. Book *theLordOfTheRing = [[Book alloc] init]; ... NSLog(@"title: %@", theLordOfTheRing.titleName); theLordOfTheRing.titleName = nil; [theLordOfTheRing…
Kernelzero
  • 103
  • 12
-1
votes
2 answers

iOS non-zero reference count in ARC and cannot dealloc

Hi All I am trying to dealloc a ViewController in ARC mode. However, the RefCount is always non-zero. I have tried to set all object to nil and all subviews to removeFromSuperview + nil; and timer to invalidate + nil; still the counter = 2; Is…
MobileDev
  • 178
  • 2
  • 13
-1
votes
1 answer

Dealloc method does not called due to blocks

I am written below code in a button click function. - (IBAction)btnPlusClicked:(id)sender forEvent:(UIEvent *)event { //show popover controller TSActionSheet* actionSheet = [[TSActionSheet alloc] initWithTitle:nil]; [actionSheet…
-1
votes
1 answer

Obj-c: Allocating a subclassed object from another object and releasing

While profiling my app with Instruments, I found a leak with an array that I allocated. To my knowledge I was doing this correctly, but it looks like something is wrong. Let's say I have three classes, class M, A and B. Subclass B has a unique…
Chewie The Chorkie
  • 3,401
  • 4
  • 37
  • 77
-1
votes
1 answer

UIViewController dealloc after init

Why myView is dealloc after init? MainViewController: [MOBubbleView hudWithBody:@"123123" bubblePoint:CGPointMake(220, headerMenu.center.y) hidesAfter:2 show:YES]; MOBubbleView.h: @interface MOBubbleView : UIViewController @property (nonatomic,…
dev.nikolaz
  • 3,162
  • 3
  • 16
  • 29
-1
votes
2 answers

NSMutableArray released twice by release

In didFinishLaunchingWithOptions, the first code is: NSMutableArray *k = [[NSMutableArray alloc] initWithCapacity:10]; [k release]; (I reduced it to this case after much debugging) and I'm getting *** -[__NSArrayM class]: message sent to…
Joris Weimar
  • 3,966
  • 3
  • 29
  • 48
-1
votes
3 answers

Objective- C prevent NSString from being released/ dealloc

Total newbie Iphone/ Obj. C question: I have a class called Location, in the Location.h i declare: @interface Location : NSObject { NSString *lat; NSString *lon; } In my Location.m i have to methods:…
fweigl
  • 19,982
  • 18
  • 97
  • 188
-1
votes
1 answer

dealloc of view controller is not called?

i dont know why the dealloc of the viewcontroller is not calling please see the code snippet. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath…
Prabhat Kasera
  • 1,111
  • 11
  • 28
-2
votes
1 answer

Rust: memory deallocation for String

Do I need to deallocate memory manually in this case: let mut s = String::new(); ...somecode here... s = String::new(); and is it the best way to erase content of the string?
-2
votes
2 answers

Can i use the dealloc() method in ARC in objective c?

I am a newbie in objective-c I have a lot of memory issues, and a lot of alloc variables -what to do?
Anurag Sharma
  • 2,823
  • 1
  • 21
  • 38
-2
votes
1 answer

Stop objects from being deallocated even when it has strong pointers to it

I have an array of employee objects. Whenever I print them using NSLog(), the array gets logged but it starts to deallocate the employee objects though I have not assigned the objects to nil. Here is my Employee.h : @interface :…
methi1999
  • 25
  • 5
-2
votes
3 answers

iOS dealloc crash

find a strange code here I have a viewcontroller, it has an array with books, and click the cell, then push to a detailViewController, detailVC has a variable infoDict, @property (nonatomic,retain) NSMutableDictionary *…
nickyu
  • 141
  • 1
  • 11
-2
votes
2 answers

can't do super dealloc and need explanation about dealloc and release what is the differences between them?

That code is right? It doesn't dealloc and release it's saying that "super dealloc ARC forbids" when I need to do dealloc and when I need to do release? #import "ImageViewController.h" @interface ImageViewController () @end @implementation…
Benbo
  • 1
  • 1
1 2 3
33
34