#10 new
Robin Summerhill

Retain cycle causes ARBase and ARRelationship leaks

Reported by Robin Summerhill | February 13th, 2009 @ 08:39 AM

ARBase retains its relationships but each relationship also retains its parent 'record' creating a retain cycle.

Change the record property of ARRelationship to a weak reference (c.f. delegates).

diff --git a/Source/Relationships/ARRelationship.h b/Source/Relationships/ARRelationship.h
index 04f9753..6d8d73c 100755
--- a/Source/Relationships/ARRelationship.h
+++ b/Source/Relationships/ARRelationship.h
@@ -51,7 +51,7 @@
   ARBase *record;
 @property(readwrite, retain) NSString *name, *className;
-@property(readwrite, retain) ARBase *record;
+@property(readwrite, assign) ARBase *record;
  * Creates a relationship with a given name using the passed class

No comments found

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

ActiveRecord is an insanely easy to use database framework written in objective-c It's obviously "inspired" by (copying) the infamous ActiveRecord that comes with Rails(http://rubyonrails.org) But it tries to be more versatile when it comes to working with multiple connections.

People watching this ticket