firebase / firebase-ios-sdk

Firebase SDK for Apple App Development
https://firebase.google.com
Apache License 2.0
5.54k stars 1.44k forks source link

NotificationExtension memory limit used by GoogleDataTransport singletons #12682

Open patryk-sredzinski opened 5 months ago

patryk-sredzinski commented 5 months ago

Description

NotificationServiceExtension has it's own very limited memory RAM available to run.

GoogleDataTransport loads it's singleton in static load function, which causes the memory to be wasted.

In my example I am having this kind of setup:

App Target Push NotificationExtension Target Networking framework

both App and PushNotification targets, require Networking framework Networking framework has Podfile dependency to Firebase (I am using Firebase's AppCheck to achieve secure connection)

Just by having Firebase included in Networking target (even if I disable all code related to Firebase in Networking target) it still loads and takes up memory.

Can't find a solution that allows me to have Firebase as a dependency to a Framework. Was thinking of some predefinied makros, but can't get it working.

Zrzut ekranu 2024-04-2 o 18 52 58 Zrzut ekranu 2024-04-2 o 18 53 11 Zrzut ekranu 2024-04-2 o 19 09 02

Reproducing the issue

Add Firebase dependencies, but do not use it anywhere, do not configure FirebaseApp, do not import any Firebase code. Observe it allocates memory.

Firebase SDK Version

10.23.0

Xcode Version

15.3

Installation Method

CocoaPods

Firebase Product(s)

App Check

Targeted Platforms

iOS

If using CocoaPods, the project's Podfile.lock

Firebase is a part of 'VFirebase' target, that is a 'VTokenProvider' dependency, that is used both in App and PushNotificationExtension

Expand Podfile.lock snippet
```yml PODS: - AppCheckCore (10.18.1): - GoogleUtilities/Environment (~> 7.11) - PromisesObjC (~> 2.3) - Checkout (4.3.2): - CheckoutEventLoggerKit (~> 1.2.4) - Risk (= 2.0.1) - CheckoutEventLoggerKit (1.2.4) - CountryPickerView (3.3.0) - DeviceKit (5.2.2) - FingerprintPro (2.2.0) - Firebase/Core (10.23.1): - Firebase/CoreOnly - FirebaseAnalytics (~> 10.23.1) - Firebase/CoreOnly (10.23.1): - FirebaseCore (= 10.23.1) - Firebase/Crashlytics (10.23.1): - Firebase/CoreOnly - FirebaseCrashlytics (~> 10.23.0) - Firebase/Messaging (10.23.1): - Firebase/CoreOnly - FirebaseMessaging (~> 10.23.0) - Firebase/RemoteConfig (10.23.1): - Firebase/CoreOnly - FirebaseRemoteConfig (~> 10.23.0) - Firebase/Storage (10.23.1): - Firebase/CoreOnly - FirebaseStorage (~> 10.23.0) - FirebaseABTesting (10.23.0): - FirebaseCore (~> 10.0) - FirebaseAnalytics (10.23.1): - FirebaseAnalytics/AdIdSupport (= 10.23.1) - FirebaseCore (~> 10.0) - FirebaseInstallations (~> 10.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.11) - GoogleUtilities/MethodSwizzler (~> 7.11) - GoogleUtilities/Network (~> 7.11) - "GoogleUtilities/NSData+zlib (~> 7.11)" - nanopb (< 2.30911.0, >= 2.30908.0) - FirebaseAnalytics/AdIdSupport (10.23.1): - FirebaseCore (~> 10.0) - FirebaseInstallations (~> 10.0) - GoogleAppMeasurement (= 10.23.1) - GoogleUtilities/AppDelegateSwizzler (~> 7.11) - GoogleUtilities/MethodSwizzler (~> 7.11) - GoogleUtilities/Network (~> 7.11) - "GoogleUtilities/NSData+zlib (~> 7.11)" - nanopb (< 2.30911.0, >= 2.30908.0) - FirebaseAppCheck (10.23.0): - AppCheckCore (~> 10.18) - FirebaseAppCheckInterop (~> 10.17) - FirebaseCore (~> 10.0) - GoogleUtilities/Environment (~> 7.8) - PromisesObjC (~> 2.1) - FirebaseAppCheckInterop (10.23.0) - FirebaseAuthInterop (10.23.0) - FirebaseCore (10.23.1): - FirebaseCoreInternal (~> 10.0) - GoogleUtilities/Environment (~> 7.12) - GoogleUtilities/Logger (~> 7.12) - FirebaseCoreExtension (10.23.0): - FirebaseCore (~> 10.0) - FirebaseCoreInternal (10.23.0): - "GoogleUtilities/NSData+zlib (~> 7.8)" - FirebaseCrashlytics (10.23.0): - FirebaseCore (~> 10.5) - FirebaseInstallations (~> 10.0) - FirebaseRemoteConfigInterop (~> 10.23) - FirebaseSessions (~> 10.5) - GoogleDataTransport (~> 9.2) - GoogleUtilities/Environment (~> 7.8) - nanopb (< 2.30911.0, >= 2.30908.0) - PromisesObjC (~> 2.1) - FirebaseInstallations (10.23.0): - FirebaseCore (~> 10.0) - GoogleUtilities/Environment (~> 7.8) - GoogleUtilities/UserDefaults (~> 7.8) - PromisesObjC (~> 2.1) - FirebaseMessaging (10.23.0): - FirebaseCore (~> 10.0) - FirebaseInstallations (~> 10.0) - GoogleDataTransport (~> 9.3) - GoogleUtilities/AppDelegateSwizzler (~> 7.8) - GoogleUtilities/Environment (~> 7.8) - GoogleUtilities/Reachability (~> 7.8) - GoogleUtilities/UserDefaults (~> 7.8) - nanopb (< 2.30911.0, >= 2.30908.0) - FirebaseRemoteConfig (10.23.0): - FirebaseABTesting (~> 10.0) - FirebaseCore (~> 10.0) - FirebaseInstallations (~> 10.0) - FirebaseRemoteConfigInterop (~> 10.23) - FirebaseSharedSwift (~> 10.0) - GoogleUtilities/Environment (~> 7.8) - "GoogleUtilities/NSData+zlib (~> 7.8)" - FirebaseRemoteConfigInterop (10.23.0) - FirebaseSessions (10.23.0): - FirebaseCore (~> 10.5) - FirebaseCoreExtension (~> 10.0) - FirebaseInstallations (~> 10.0) - GoogleDataTransport (~> 9.2) - GoogleUtilities/Environment (~> 7.10) - nanopb (< 2.30911.0, >= 2.30908.0) - PromisesSwift (~> 2.1) - FirebaseSharedSwift (10.23.0) - FirebaseStorage (10.23.0): - FirebaseAppCheckInterop (~> 10.0) - FirebaseAuthInterop (~> 10.0) - FirebaseCore (~> 10.0) - FirebaseCoreExtension (~> 10.0) - GTMSessionFetcher/Core (< 4.0, >= 2.1) - Frames (4.3.2): - Checkout (= 4.3.2) - CheckoutEventLoggerKit (~> 1.2.4) - PhoneNumberKit - Giphy (2.2.8): - libwebp - GoogleAppMeasurement (10.23.1): - GoogleAppMeasurement/AdIdSupport (= 10.23.1) - GoogleUtilities/AppDelegateSwizzler (~> 7.11) - GoogleUtilities/MethodSwizzler (~> 7.11) - GoogleUtilities/Network (~> 7.11) - "GoogleUtilities/NSData+zlib (~> 7.11)" - nanopb (< 2.30911.0, >= 2.30908.0) - GoogleAppMeasurement/AdIdSupport (10.23.1): - GoogleAppMeasurement/WithoutAdIdSupport (= 10.23.1) - GoogleUtilities/AppDelegateSwizzler (~> 7.11) - GoogleUtilities/MethodSwizzler (~> 7.11) - GoogleUtilities/Network (~> 7.11) - "GoogleUtilities/NSData+zlib (~> 7.11)" - nanopb (< 2.30911.0, >= 2.30908.0) - GoogleAppMeasurement/WithoutAdIdSupport (10.23.1): - GoogleUtilities/AppDelegateSwizzler (~> 7.11) - GoogleUtilities/MethodSwizzler (~> 7.11) - GoogleUtilities/Network (~> 7.11) - "GoogleUtilities/NSData+zlib (~> 7.11)" - nanopb (< 2.30911.0, >= 2.30908.0) - GoogleDataTransport (9.4.1): - GoogleUtilities/Environment (~> 7.7) - nanopb (< 2.30911.0, >= 2.30908.0) - PromisesObjC (< 3.0, >= 1.2) - GoogleUtilities/AppDelegateSwizzler (7.13.0): - GoogleUtilities/Environment - GoogleUtilities/Logger - GoogleUtilities/Network - GoogleUtilities/Privacy - GoogleUtilities/Environment (7.13.0): - GoogleUtilities/Privacy - PromisesObjC (< 3.0, >= 1.2) - GoogleUtilities/Logger (7.13.0): - GoogleUtilities/Environment - GoogleUtilities/Privacy - GoogleUtilities/MethodSwizzler (7.13.0): - GoogleUtilities/Logger - GoogleUtilities/Privacy - GoogleUtilities/Network (7.13.0): - GoogleUtilities/Logger - "GoogleUtilities/NSData+zlib" - GoogleUtilities/Privacy - GoogleUtilities/Reachability - "GoogleUtilities/NSData+zlib (7.13.0)": - GoogleUtilities/Privacy - GoogleUtilities/Privacy (7.13.0) - GoogleUtilities/Reachability (7.13.0): - GoogleUtilities/Logger - GoogleUtilities/Privacy - GoogleUtilities/UserDefaults (7.13.0): - GoogleUtilities/Logger - GoogleUtilities/Privacy - GTMSessionFetcher/Core (3.3.2) - IteoLogger (1.4.3) - KeychainSwift (21.0.0) - libwebp (1.3.2): - libwebp/demux (= 1.3.2) - libwebp/mux (= 1.3.2) - libwebp/sharpyuv (= 1.3.2) - libwebp/webp (= 1.3.2) - libwebp/demux (1.3.2): - libwebp/webp - libwebp/mux (1.3.2): - libwebp/demux - libwebp/sharpyuv (1.3.2) - libwebp/webp (1.3.2): - libwebp/sharpyuv - nanopb (2.30910.0): - nanopb/decode (= 2.30910.0) - nanopb/encode (= 2.30910.0) - nanopb/decode (2.30910.0) - nanopb/encode (2.30910.0) - NVActivityIndicatorView (5.1.1): - NVActivityIndicatorView/Base (= 5.1.1) - NVActivityIndicatorView/Base (5.1.1) - PhoneNumberKit (3.7.10): - PhoneNumberKit/PhoneNumberKitCore (= 3.7.10) - PhoneNumberKit/UIKit (= 3.7.10) - PhoneNumberKit/PhoneNumberKitCore (3.7.10) - PhoneNumberKit/UIKit (3.7.10): - PhoneNumberKit/PhoneNumberKitCore - PINCache (3.0.3): - PINCache/Arc-exception-safe (= 3.0.3) - PINCache/Core (= 3.0.3) - PINCache/Arc-exception-safe (3.0.3): - PINCache/Core - PINCache/Core (3.0.3): - PINOperation (~> 1.2.1) - PINOperation (1.2.2) - PINRemoteImage/Core (3.0.3): - PINOperation - PINRemoteImage/iOS (3.0.3): - PINRemoteImage/Core - PINRemoteImage/PINCache (3.0.3): - PINCache (~> 3.0.3) - PINRemoteImage/Core - PromisesObjC (2.4.0) - PromisesSwift (2.4.0): - PromisesObjC (= 2.4.0) - Reachability (3.7.5) - Realm (10.49.1): - Realm/Headers (= 10.49.1) - Realm/Headers (10.49.1) - RealmSwift (10.49.1): - Realm (= 10.49.1) - Risk (2.0.1): - CheckoutEventLoggerKit (~> 1.2.4) - FingerprintPro (= 2.2.0) - SDWebImage (5.19.1): - SDWebImage/Core (= 5.19.1) - SDWebImage/Core (5.19.1) - SnapKit (5.7.1) - SPAsyncVideoView (1.0) - SVProgressHUD (2.3.1): - SVProgressHUD/Core (= 2.3.1) - SVProgressHUD/Core (2.3.1) - SwiftGen (6.6.3) - SwiftLint (0.54.0) - SwiftyJSON (5.0.1) - Texture (3.1.0): - Texture/AssetsLibrary (= 3.1.0) - Texture/Core (= 3.1.0) - Texture/MapKit (= 3.1.0) - Texture/Photos (= 3.1.0) - Texture/PINRemoteImage (= 3.1.0) - Texture/Video (= 3.1.0) - Texture/AssetsLibrary (3.1.0): - Texture/Core - Texture/Core (3.1.0) - Texture/MapKit (3.1.0): - Texture/Core - Texture/Photos (3.1.0): - Texture/Core - Texture/PINRemoteImage (3.1.0): - PINRemoteImage/iOS (~> 3.0.0) - PINRemoteImage/PINCache - Texture/Core - Texture/Video (3.1.0): - Texture/Core - Toast-Swift (5.1.0) - ZLPhotoBrowser (4.5.0): - ZLPhotoBrowser/Core (= 4.5.0) - ZLPhotoBrowser/Core (4.5.0) DEPENDENCIES: - CountryPickerView - DeviceKit - Firebase/Core - Firebase/Crashlytics - Firebase/Messaging - Firebase/RemoteConfig - Firebase/Storage - FirebaseAppCheck - Frames - Giphy - IteoLogger (from `https://github.com/psredzinski/IteoLogger.git`) - KeychainSwift - NVActivityIndicatorView - PhoneNumberKit - Reachability - RealmSwift - SDWebImage - SnapKit - SPAsyncVideoView (from `https://github.com/patryk-sredzinski/SPAsyncVideoView.git`, branch `vama`) - SVProgressHUD - SwiftGen - SwiftLint - SwiftyJSON - Texture - Toast-Swift - ZLPhotoBrowser (from `https://github.com/patryk-sredzinski/ZLPhotoBrowser.git`, branch `vama`) SPEC REPOS: https://github.com/CocoaPods/Specs.git: - AppCheckCore - Checkout - CheckoutEventLoggerKit - CountryPickerView - DeviceKit - FingerprintPro - Firebase - FirebaseABTesting - FirebaseAnalytics - FirebaseAppCheck - FirebaseAppCheckInterop - FirebaseAuthInterop - FirebaseCore - FirebaseCoreExtension - FirebaseCoreInternal - FirebaseCrashlytics - FirebaseInstallations - FirebaseMessaging - FirebaseRemoteConfig - FirebaseRemoteConfigInterop - FirebaseSessions - FirebaseSharedSwift - FirebaseStorage - Frames - Giphy - GoogleAppMeasurement - GoogleDataTransport - GoogleUtilities - GTMSessionFetcher - KeychainSwift - libwebp - nanopb - NVActivityIndicatorView - PhoneNumberKit - PINCache - PINOperation - PINRemoteImage - PromisesObjC - PromisesSwift - Reachability - Realm - RealmSwift - Risk - SDWebImage - SnapKit - SVProgressHUD - SwiftGen - SwiftLint - SwiftyJSON - Texture - Toast-Swift EXTERNAL SOURCES: IteoLogger: :git: https://github.com/psredzinski/IteoLogger.git SPAsyncVideoView: :branch: vama :git: https://github.com/patryk-sredzinski/SPAsyncVideoView.git ZLPhotoBrowser: :branch: vama :git: https://github.com/patryk-sredzinski/ZLPhotoBrowser.git CHECKOUT OPTIONS: IteoLogger: :commit: cbd766d410e078d82073c40a77af249ad1ac48fe :git: https://github.com/psredzinski/IteoLogger.git SPAsyncVideoView: :commit: 5815ac22d889eb0234e14db22f3e516e62e1ab21 :git: https://github.com/patryk-sredzinski/SPAsyncVideoView.git ZLPhotoBrowser: :commit: d4692f9f9cd8d27c3f4ce479e306a4f2d58d2967 :git: https://github.com/patryk-sredzinski/ZLPhotoBrowser.git SPEC CHECKSUMS: AppCheckCore: d0d4bcb6f90fd9f69958da5350467b79026b38c7 Checkout: 0ccc5857964731042f49c8addacc9671d77b7b08 CheckoutEventLoggerKit: b780dec46295a34942780ea6230d0d5fd08aa05a CountryPickerView: 6322ada32a80b0cd721b0267282a5c24f406f263 DeviceKit: e36aaf2a0d142ef0b4fac2007649a4414af234be FingerprintPro: 72e35dc0315b75ba36eafaaed996dbb2f35f7326 Firebase: cf09623f98ae25a3ad484e23c7e0e5f464152d80 FirebaseABTesting: aec61ed9a34d85a95e2013a3fdf051426a2419df FirebaseAnalytics: fd35d51e6da86ef1aa2c3fe1f64ab2482cc01ba5 FirebaseAppCheck: 4bb8047366c2c975583c9eff94235f8f2c5b342d FirebaseAppCheckInterop: a1955ce8c30f38f87e7d091630e871e91154d65d FirebaseAuthInterop: a458e398bb1e9b71b9b42d46e54acc666b021d0f FirebaseCore: c43f9f0437b50a965e930cac4ad243200d12a984 FirebaseCoreExtension: cb88851781a24e031d1b58e0bd01eb1f46b044b5 FirebaseCoreInternal: 6a292e6f0bece1243a737e81556e56e5e19282e3 FirebaseCrashlytics: b7aca2d52dd2440257a13741d2909ad80745ac6c FirebaseInstallations: 42d6ead4605d6eafb3b6683674e80e18eb6f2c35 FirebaseMessaging: 1b2270e66c81bbf184f70184db1d6a736ad0def5 FirebaseRemoteConfig: 70ebe9542cf5242d762d1c0b4d53bfc472e0a4ce FirebaseRemoteConfigInterop: cbc87ffa4932719a7911a08e94510f18f026f5a7 FirebaseSessions: f06853e30f99fe42aa511014d7ee6c8c319f08a3 FirebaseSharedSwift: c92645b392db3c41a83a0aa967de16f8bad25568 FirebaseStorage: 96fd765b2ef632c53b214057691e257538b8c496 Frames: 7d069876d2c0323d5b6ddd54efe1217c26225819 Giphy: f63ab0e2dd819d6288feba07722aaafe8a5fe4b7 GoogleAppMeasurement: 794d1d2f71fdf77a077a3986258a5c2dac0f9d48 GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a GoogleUtilities: d053d902a8edaa9904e1bd00c37535385b8ed152 GTMSessionFetcher: 0e876eea9782ec6462e91ab872711c357322c94f IteoLogger: af82d0d96c99e51a5cd4a18981d92674af99c427 KeychainSwift: 4a71a45c802fd9e73906457c2dcbdbdc06c9419d libwebp: 1786c9f4ff8a279e4dac1e8f385004d5fc253009 nanopb: 438bc412db1928dac798aa6fd75726007be04262 NVActivityIndicatorView: 1f6c5687f1171810aa27a3296814dc2d7dec3667 PhoneNumberKit: 3d9a20cfe8ee68f35c2a3ae9474093133f72a8a1 PINCache: 7a8fc1a691173d21dbddbf86cd515de6efa55086 PINOperation: daa34d4aa1d8449089be7d405b9d974abc4724c6 PINRemoteImage: f1295b29f8c5e640e25335a1b2bd9d805171bd01 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851 Reachability: 44d15955cdaee6cef699877e1f6647dd6f6698cc Realm: 1fab4a224fd7a294eca142a0efe8b54546290fbf RealmSwift: 7c3a9c001161eb01b96b171ad965a9c498b962b0 Risk: 5afc8c739782cae0c26b3d605975339ea6bd0c62 SDWebImage: 40b0b4053e36c660a764958bff99eed16610acbb SnapKit: d612e99e678a2d3b95bf60b0705ed0a35c03484a SPAsyncVideoView: 6e45ec8c991b557710a3627b43b2af57c9aadaa0 SVProgressHUD: 4837c74bdfe2e51e8821c397825996a8d7de6e22 SwiftGen: 4993cbf71cbc4886f775e26f8d5c3a1188ec9f99 SwiftLint: c1de071d9d08c8aba837545f6254315bc900e211 SwiftyJSON: 2f33a42c6fbc52764d96f13368585094bfd8aa5e Texture: 2e8ab2519452515f7f5a520f5a8f7e0a413abfa3 Toast-Swift: dd369e68ee529f542c65bd0d0c6c50cd743cf6f2 ZLPhotoBrowser: 5148db17b3a7dff068604cd7fc46d0462d92e07c PODFILE CHECKSUM: 281b307425073d36e15ece70ea429a97114d429f COCOAPODS: 1.15.2 ```
google-oss-bot commented 5 months ago

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

paulb777 commented 5 months ago

If you don't need FirebaseAnalytics, it may be a workaround to remove Firebase/Core from the Podfile. FirebaseAnalytics requires static linking, but the rest of Firebase supports dynamic linking.