All Questions
20 questions
3
votes
1
answer
328
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 ...
1
vote
1
answer
1k
views
Proper way to release an instance variable in dealloc, Objective C
I have been wondering about the proper way to release an instance variable in dealloc method of a class. Suppose I have an instance variable named myString,
// MyClass.h
{
NSString *myString;
}
@...
1
vote
0
answers
544
views
Using ARC for the Cocoa UI of an AudioUnit prevents NSView dealloc from being called
I recently converted my AudioUnit plugin to take advantage of ARC for all the interface code (Cocoa). However, this resulted in the main NSView (the one created by the CocoaViewFactory and returned to ...
4
votes
1
answer
3k
views
Cocoa NSWindowController And NSWindow Not Deallocing
I'm working with an NSWindowController to implement a preferences window. Apple's documentation states that by default the controller and window aren't deallocated, because it's useful to not have to ...
7
votes
3
answers
1k
views
Cocoa bindings and KVO, unregister the observer, when the observing object gets `dealloced`
How can i unregister the observer, when the observing object gets dealloced?
How can cocoa bindings handle a situation when the observed objects gets deallocated?
By using manual KVO, i have to ...
1
vote
1
answer
116
views
Cocoa: Finding the missing reference for deallocating
I'm almost done with and app and I'm using instruments to analyse it. I'm having a problem with ARC deallocating something, but I don't know what. I run instruments using the allocations tool ,what I'...
2
votes
1
answer
76
views
Deallocking an object that contains a block
First of all (and since this question has to do with memory management), I have to say I'm running on ARC.
I have an object (MyObject) which contains an array of MyProcess objects. MyObject, at a ...
1
vote
1
answer
688
views
AXUIElementRef and ARC - Deallocated instances and __bridge vs __bridge_transfer
I get this error on an NSMutableArray:
-[Not A Type release]: message sent to deallocated instance 0x1006e29c0
It happens on this line:
[_array removeAllObjects];
Now, I understand what the ...
2
votes
4
answers
386
views
Why can I release an ivar after [super dealloc] without segfaulting?
It seems that in Objective-C, the method that is responsibile for memory allocation (like malloc() in C), is -[NSObject alloc]. What about freeing that memory? Is that done by -[NSObject dealloc]? Is ...
0
votes
2
answers
520
views
AVAudioRecorder does not stay retained
I am using AVAudioRecorder in my mac app. In my .m file I declare
@interface RecordViewController ()
{
AVAudioRecorder *audioRecorder;
...
}
@end
further down I then alloc init the object like so:...
4
votes
2
answers
825
views
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 ...
1
vote
3
answers
155
views
Confusion on dealloc calls
I have a basic question here.
I know that dealloc will be called when the object's reference count becomes zero,and dealloc releases all the resources hold by the object or frees memory, right?
The ...
0
votes
1
answer
1k
views
zombie event in Cocoa
I have a EXC_BAD_ACCESS error. I used Profile in xCode 4 to see what is happening with memory and saw that it is zombie event:
An Objective-C message was sent to a deallocated object(zombie) at ...
5
votes
2
answers
2k
views
removeObserver:forKeyPath: in dealloc
If my instance is observing some property of another object, am I supposed to call removeObserver:forKeyPath: in dealloc?
3
votes
1
answer
4k
views
Removing Observer in Dealloc
SOLVED - it turns out that passing nil to removeObserver:forKeyPath: fails, but ONLY in manual memory management. It works fine in garbage collected mode. The Apple documentation does NOT say it ...