On 20 Aug 2013, at 23:32, Diederik Meijer | Ten Horses <diede...@tenhorses.com> 
wrote:

> Dear list,
> 
> I have the following structure:
> 
> An itemStore object creates a worker object (property of itemStore object) 
> that hold a weak reference back to the itemStore object;
> When the worker classes is done, it sets the itemStore object (of which the 
> worker class itself is a property) to nil.
> 
> This project uses ARC.
> 
> So within itemStore I do:
> self.worker = [[Worker alloc] init];
> [self.worker setItemStore:self];
> 
> In Worker.h I do
> @property (nonatomic, weak) ItemStore *itemStore;
> 
> In Worker.m, when all its tasks are done, I do
> self.itemStore = nil;
> 
> I assume this completely destroys the itemStore object and all objects it 
> exclusively owns.
> 
> Is there any way to NSLog the destruction of the itemStore object?
> 
> I tried putting a log in itemStore's dealloc method, but it doesn't show up 
> in the console.

No, this doesn’t destroy the item store at all.  If the Worker holds a weak 
reference, then it setting its reference to nil will not do anything at all re 
memory management.  Instead, whatever is holding strong references to the item 
store needs to release those references.

Tom Davie
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to