-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
Bug 🐞This is a bug with existing functionality not behaving as expectedThis is a bug with existing functionality not behaving as expected
Description
Steps to reproduce
I've been writing a tool to detect memory leaks from the current unit test coverage and I have found a instance of retain cycle in BrowserViewController when handlePDFDownloadRequest is invoked. Attaching the method and test in which I found this leak with report:
The methodology to detect leak from unit is quiet easy we invoke the leaks tool from a HTTP server during tear down as the last step to check existence of any retain cycle.
In BrowserViewControllerTests we have 3 tests that invoke handlePDFDownloadRequest method:
- testHandlePDFDownloadRequest_callsEnqueueDocumentOnTab
- testHandlePDFDownloadRequest_showDocumentLoadingView_whenTabSelected
- testHandlePDFDownloadRequest_doesntDocumentLoadingView_whenTabNotSelected
This method has following retain cycle:
66 (8.70K) ROOT CYCLE: <DefaultTemporaryDocument 0x6000035782c0> [176]
49 (7.28K) onDownload + 8 --> ROOT CYCLE: <Swift closure context 0x600001943280> [64]
--> CYCLE BACK TO <DefaultTemporaryDocument 0x6000035782c0> [176]
48 (7.22K) __strong --> ROOT CYCLE: <MockTab 0x105eb9a50> [944]
temporaryDocument --> CYCLE BACK TO <DefaultTemporaryDocument 0x6000035782c0> [176]
33 (5.03K) profile --> <MockProfile 0x106c733c0> [544]
7 (1.20K) $__lazy_storage_$_places --> <RustPlaces 0x60000331dcc0> [160]
2 (368 bytes) __strong readerQueue --> <dispatch_queue_t (serial) 0x600002c9e800> [128]
1 (240 bytes) 0x600003dca760 [240]
2 (368 bytes) __strong writerQueue --> <dispatch_queue_t (serial) 0x600002c9d400> [128]
1 (240 bytes) 0x600003dc9a40 [240]
1 (224 bytes) databasePath + 8 --> <CFString 0x600003bf1260> [224]
1 (112 bytes) logger --> <Swift closure context 0x600002982450> [112]
5 (864 bytes) $__lazy_storage_$_logins --> <RustLogins 0x6000030582d0> [144]
2 (368 bytes) __strong queue --> <dispatch_queue_t (serial) 0x600002c72380> [128]
1 (240 bytes) 0x600003dbc4b0 [240]
1 (240 bytes) perFieldDatabasePath + 8 --> <CFString 0x600003dbd680> [240]
1 (112 bytes) logger --> <Swift closure context 0x6000029503f0> [112]
5 (800 bytes) $__lazy_storage_$_database --> <BrowserDB 0x600002142e90> [80]
3 (496 bytes) __strong db --> <SwiftData 0x600003058240> [144]
2 (352 bytes) __strong primaryConnectionQueue --> <dispatch_queue_t (serial) 0x600002c71500> [128]
1 (224 bytes) 0x600003c382a0 [224]
1 (224 bytes) databasePath + 8 --> <CFString 0x600003c38540> [224]
4 (688 bytes) $__lazy_storage_$_tabs --> <RustRemoteTabs 0x6000029672c0> [112]
2 (352 bytes) __strong queue --> <dispatch_queue_t (serial) 0x600002c7a680> [128]
1 (224 bytes) 0x600003c34000 [224]
1 (224 bytes) databasePath + 8 --> <CFString 0x600003c341c0> [224]
1 (400 bytes) directory + 8 --> <NSPathStore2 0x106c54450> [400]
5 (320 bytes) syncManager --> <ClientSyncManagerSpy 0x600002982610> [112]
4 (208 bytes) __strong emptySyncResult --> <Shared.Deferred<Shared.Maybe<MozillaAppServices.SyncResult>> 0x60000082c980> [32]
3 (176 bytes) __strong protected --> <Shared.LockProtected<(protectedValue: Swift.Optional<Shared.Maybe<MozillaAppServices.SyncResult>>, uponBlocks: Swift.Array<(__C.OS_dispatch_queue, (Shared.Maybe<MozillaAppServices.SyncResult>) -> ())>)> 0x600002c9fb00> [128]
Expected behavior
No Leaks
Actual behavior
Retain cycle found
Device & build information
- Device: ?
- Build version: ?
- First seen version: ?
Notes
Attachments:
┆Issue is synchronized with this Jira Task
Metadata
Metadata
Assignees
Labels
Bug 🐞This is a bug with existing functionality not behaving as expectedThis is a bug with existing functionality not behaving as expected