Skip to main content

All Questions

3 votes
2 answers
4k views

When is `deinit` exactly called? (in Swift)

When is deinit exactly called? Is it like C++ guaranteed to be called when last reference gets out of scope (by return, throw or exit)? Or is Swift using Garbage-Collector?
Top-Master's user avatar
  • 8,669
2 votes
1 answer
912 views

Is it possible for dealloc to be called on an object whose retain count is NOT zero?

I'll keep this short and obvious: I have an object whose dealloc method is being called. I also have an NSTimer being called every 3 seconds to log to console the current retain count of said object. ...
Tony Friz's user avatar
  • 893
0 votes
1 answer
39 views

WatchKit without ARC causes crash when dealloc

The watch app I am developing is not using ARC. And so I releases all the properties of objects in each interface in dealloc as below. -(void)dealloc { [obj1 release]; [obj2 release]; ... [...
GeneCode's user avatar
  • 7,588
0 votes
3 answers
318 views

Xcode memory profiler ARC disable

I developed OSX project in objective-c. I disabled ARC and I dealloc(release) memory manually. Is in xcode any tool, which can show me that I forget release any objects?
Patrik Dendis's user avatar
5 votes
3 answers
150 views

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 ...
Vinny's user avatar
  • 237
23 votes
1 answer
2k views

Why setting object that is undergoing deallocation to weak property results in crash

In Clang's Objective-C Automatic Reference Counting we see the following For __weak objects, the lvalue is updated to point to the new pointee, unless the new pointee is an object currently ...
Nikita Ilyasov's user avatar
0 votes
4 answers
1k views

Are Unowned references set to 'nil' when deinitialized?

I'm confused on this topic in swift where it is said that unowned references must always have a value and cannot be optional, also meaning they cannot be set to 'nil'....well I just saw a program on ...
Ali 's user avatar
  • 515
1 vote
2 answers
132 views

How to dealloc CGPoint, CGRect variables?

I'm using Objective-C. I use automatic-ref-counting. I have a lot of CGPoint and CGRect variables in my code. I get memory errors. How can I dealloc after used.
user1720057's user avatar
0 votes
2 answers
55 views

ARC releases my object somewhere in Apple's UI library

I have a local variable UINavigationConroller *nav. Not 10 lines after it's declared, within the same method, it is passed to [self presentViewController:nav animated:YES completion:nil] (self is a ...
Ky -'s user avatar
  • 32.2k
0 votes
2 answers
401 views

ARC + Dealloc is not called

I am little confuse because my dealloc is not called in ARC. I have using storyboard in my application. Case 1: Mydealloc called when i use all IBOutlet from storyboard Case 2: My dealloc is not ...
Hindu's user avatar
  • 2,914
0 votes
2 answers
189 views

iOS: View Controller Instance does not deallocated if I pass it to dispatch_async block

UIViewController* vc = [[NSClassFromString(record.anObject) alloc] initWithNibName:record.anObject bundle:nil]; 1) [myNavigationController navigateToViewController:vc animated:NO]; 2) dispatch_async(...
sam18's user avatar
  • 641
1 vote
1 answer
368 views

Correctly Releasing SystemSoundID

I'm using AudioToolbox and SystemSoundID to load and play a sound. Here's my code in my viewDidLoad method: NSString *swipeFilePath = [[NSBundle mainBundle] pathForResource:@"swipe" ofType:@"caf"]; ...
KingPolygon's user avatar
  • 4,755
0 votes
1 answer
211 views

Does dealloc still get called?

For my iOS 7 app, just want to confirm: Does dealloc still get called? Does it have something to do with whether ARC is enabled or not?
Firdous's user avatar
  • 4,652
-1 votes
2 answers
357 views

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 ...
MobileDev's user avatar
  • 176
3 votes
1 answer
321 views

Destroy object in background thread Objective C

I have a absolutely huge array (~10 million objects which themselves hold substantial data). Destroying this object causes a quite long lag on the main thread of roughly 5 seconds. While this is just ...
utahwithak's user avatar
  • 6,325

15 30 50 per page