New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Retain cycle from RACAbleSelf #40
Comments
You should absolutely be using a The other objects hanging around sounds odd. I'll take a look. |
Ok, thanks. Is the need for a weak or unsafe_unretained pointer to self documented anywhere? I only thought to try it after poking around in the list of issues and noticing it mentioned there. Colin On 2012-08-24, at 11:01, Josh Abernathy wrote:
|
@ctsimmonds That PR resolves it. Thanks for bringing it up and especially for including the sample code! |
Investigating some memory leaks in my application, I've found that whenever I use RACAbleSelf to subscribe for changes to a property on an object, that object is never freed. If I use a weak pointer inside the block, my object is freed, but about 60 KB of RAC infrastructure is retained somehow even though nothing is actively referencing it.
I've reproduced this with the following simple code:
If I pass YES into the initializer for MyClass, its instance is freed, but it's not if I pass in NO instead. Either way, after running this, in Instruments.app I see about 60 KB of memory still allocated, including several RAC objects: 1 RACReplaySubject, 1 RACSubscribable, 1 RACSubscriber, and 2 RACDisposables.
My expectation is that when nothing references the object being subscribed to anymore, it and all of the objects created by RAC for the subscription would be cleaned up.
The text was updated successfully, but these errors were encountered: