-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Memory leak (retain cycle) in [FIRQuery getDocumentsWithSource:completion:] #2564
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
Comments
Thanks for sending this over! I will route this internally to the right person and we should be able to get this fixed soon. Looking at this briefly, the call |
@schmidt-sebastian Yes, I think you're right. I've put a breakpoint on there and I'm going through that error path.
|
Just FYI, I have managed to reproduce this. It only happens on the error path, but removing the listener isn't the fix since listeners automatically are unregistered when there's an error. I'm working on a fix. |
@ewanmellor I haven't forgotten you, but we have a big effort underway to make this SDK available in C++ and I folded the resolution of this into that effort. Our next release window is coming up and if all goes well these fixes will end up in there. Thanks for your patience. |
Those three fixes have now been submitted and will go out with our next release. |
Uh oh!
There was an error while loading. Please reload this page.
[REQUIRED] Step 2: Describe your environment
[REQUIRED] Step 3: Describe the problem
There is a retain cycle identified by Xcode Instruments as shown below.
From Firestore/Source/API/FIRQuery.mm:113:
My reading is as follows:
FIRQuerySnapshotBlock listener
is a callback block that is given toaddSnapshotListenerInternalWithOptions
.__block id<FIRListenerRegistration> listenerRegistration
.listenerRegistration
is the result of theaddSnapshotListenerInternalWithOptions
call, which ultimately contains a reference tolistener
.listenerRegistration
, so there is a retain cycle and a leak once the callback is complete.I don't know enough about the code here to be sure, but my guess is that setting
listenerRegistration = nil
after each of the threecompletion()
calls would fix the problem.The text was updated successfully, but these errors were encountered: