iOS Safari Extension Memory Limit 6MB

We are trying to develop a Safari extension for the upcoming iOS 15. We are facing unsolvable issues with the memory limit.

Our extension handler uses close to zero memory, and 80% of the memory is taken by Apple libraries. So, any time we actually do something in our handler – it crosses the 6MB limit and it gets killed.

Is there any way to avoid this, or are there any plans to increase the memory limit in future betas?

  • Hey folks - same question here. The limit for Safari Extensions is explicitly set to 6MB. Any reason/justification why?

    Thanks!

Add a Comment

Replies

This is actually a very good question, doing anything in the extension is quite problematic with a limit that low.

For instance, our use case is simple: we pass settings from the main app via a file. That file weighs more than 2MB so reading it is already problematic. We have to use some ugly workarounds and pass it in chunks instead.

It would be great if you could file some feedback at https://feedbackassistant.apple.com, along with some information about what you'd like to do with that memory.

Thanks!

The limit increased to 80MB in the latest iOS 15.1 beta.

  • Where is the documentation for this? Is there a webkit commit or issue you could point to?

Add a Comment

How do we monitor memory usage of an iOS Safari Web Extension? Does the iOS app memory usage indicate what the Safari Web Extension is using in iOS?

If you're like me and your extension is randomly breaking and you suspect a memory issue, here's what the console message looks like. Be aware it's not a fault or error in the console, this caused me to miss it initially. Side note, I still have no idea how to monitor memory usage in mobile safari whilst developing.

I'm facing the same issue. Profiling in instruments it looks like a majority of the memory is taken by anonymous VM, which as I understand is not very easy to control. I'm using Firebase in my extension, and it looks like GoogleDataTransport (a library that firebase uses under the hood) is responsible for most of the memory allocation. Not sure how I'll be able to get under 6 MB.

@timothy.hatcher any reason for such a big jump from 6 to 80 MB? This won't be back compatible to 15.0, correct?

This change will not go back into 15.0. Your users would need to upgrade to have it fixed.