Re: NSManagedObject, retain count and dealloc:

2010-04-26 Thread vincent habchi
Le 27 avr. 2010 à 00:18, Kyle Sluder a écrit :

> If your object is holding on to some resource which you need it to
> release, write a method called -invalidate or -letGoOfImportantThing
> or something and call that at a deterministic time.

Understood. I'll do that. I must admit I have a tendency to free resources at 
dealloc:, but if this does not happen, I guess I have little other choice.

Cheers
Vincent___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSManagedObject, retain count and dealloc:

2010-04-26 Thread Kyle Sluder
On Mon, Apr 26, 2010 at 2:14 PM, vincent habchi  wrote:
> I am unable to see a NSManagedObject go through the dealloc: method, even 
> after its removal from the MOC. It seems these objects are created after a 
> initWithEntity:insertIntoMOC: with an initial retain count of 2, and, of 
> course, it is impossible to make the retain count (by honest means) drop 
> below 2. Is this normal expected behavior?

As far as you're concerned, it's perfectly valid behavior for every
object in your application to never see -dealloc called, ever. As long
as you are playing by the memory management rules, you shouldn't care
one whit about when -dealloc is called. Those who work with -finalize
in a GC environment are already familiar with this drill.

If your object is holding on to some resource which you need it to
release, write a method called -invalidate or -letGoOfImportantThing
or something and call that at a deterministic time.

--Kyle Sluder
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSManagedObject, retain count and dealloc:

2010-04-26 Thread Joanna Carter
Hi Vincent

> I am unable to see a NSManagedObject go through the dealloc: method, even 
> after its removal from the MOC. It seems these objects are created after a 
> initWithEntity:insertIntoMOC: with an initial retain count of 2, and, of 
> course, it is impossible to make the retain count (by honest means) drop 
> below 2. Is this normal expected behavior?

The docs state that the MOC retains a reference to the MO until it is saved, so 
with the reference you are holding, that should make 2.

Joanna

--
Joanna Carter
Carter Consulting

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSManagedObject, retain count and dealloc:

2010-04-26 Thread Sean McBride
On Mon, 26 Apr 2010 23:14:04 +0200, vincent habchi said:

>I am unable to see a NSManagedObject go through the dealloc: method,
>even after its removal from the MOC. It seems these objects are created
>after a initWithEntity:insertIntoMOC: with an initial retain count of 2,
>and, of course, it is impossible to make the retain count (by honest
>means) drop below 2. Is this normal expected behavior?

Probably.  Why do you ask?  What do you want to do in dealloc?  Do you
know about willTurnIntoFault?

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


NSManagedObject, retain count and dealloc:

2010-04-26 Thread vincent habchi
Hi again,

I am unable to see a NSManagedObject go through the dealloc: method, even after 
its removal from the MOC. It seems these objects are created after a 
initWithEntity:insertIntoMOC: with an initial retain count of 2, and, of 
course, it is impossible to make the retain count (by honest means) drop below 
2. Is this normal expected behavior?

Thanks,
Vincent___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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