How to reduce File Provider memory footprint?

TedRogersTedRogers USMember ✭✭✭✭
edited October 2017 in Xamarin.iOS

Any ideas/tricks on how to reduce the memory footprint of my NSFileProviderExtension more than I already have?

I have done the following:
1. Got rid of
2. Got rid of System.Http.Net
3. Run file provider in Release mode (only build ARM64)

The file provider starts out with a footprint of about 11.5 MB on iPhone6 and 13.5 on iPad Pro (appex size is 2.3MB). Of course, when it hits 15 MB, BOOM!

For comparison, a file provider I built with XCode starts out with a memory footprint of about 3.4MB.

I can run for a while on my iPhone 6 but running on any iPad Pro quits upon first navigation.

I have a Pro account so I don't have access to the Xamarin Profiler.

Unfortunately, for iOS11 I needed to add Mono.Data.Sqlite. I hadn't seen this problem before adding sqlite. See references below:

Here are my iOS build settings:

Best Answer


  • DavideVostiDavideVosti CHUniversity ✭✭

    Hi Ted.

    I'm struggling with the very same issue. Did you find a solution to this issue??

  • TedRogersTedRogers USMember ✭✭✭✭
    Accepted Answer

    @DavideVosti Yes, I rewrote my FileProvider in Swift.

  • DavideVostiDavideVosti CHUniversity ✭✭

    :( that's not the answer I was looking for :( Thank you anayway

  • DavideVostiDavideVosti CHUniversity ✭✭

    Hi Ted. Can I ask you how did you include the FileProvider extension built with Swtift into the Xamarin project? Did you just add "as content" the framework built with Swift and then in the info.plist you specified which class to launch with NSExtensionPrincipalClass ?


  • TedRogersTedRogers USMember ✭✭✭✭

    I don't believe you can add the FileProvider that way but would love it if you could!

    Here is how I did it:
    1. In my Xamarin solution/project, I kept a dummy FileProvider
    2. In XCode, I created a Swift project with a dummy host app and File provider with bundle ids matching Xam app and FileProvider.
    3. I added a "Run Script" in XCode for the dummy host app that copies necessary files to a known location. Script attached.
    4. I manually added BeforeCodeSign and AfterCodeSign Targets to my Xamarin iOS app project. Added at bottom inside Project node. File attached.
    5. I'm sure this will change in the future when the build process is automated, but it works for my development purposes.

  • DavideVostiDavideVosti CHUniversity ✭✭

    Thanks a lot Ted

  • TedRogersTedRogers USMember ✭✭✭✭

    @DavideVosti You are welcome. Ping me here with any questions.

Sign In or Register to comment.