Q: iOS Action Extension - memory usage ballooning when calling another Action Extension I have an action extension which takes in an image, makes a small modification to the image (such as overlay a watermark), then allows to the user to open another UIActivityController to send the modified image to another (arbitrary) extension (such as to share the image to social media).  My extension crashes after sharing to most (but not all) extensions, due to hitting a memory limit.
The error I get is:
EXC_RESOURCE RESOURCE_TYPE_MEMORY (limit=120 MB, unused=0x0)

This happens deep within an OS-driven UIImage call.
Steps:


*

*Select an image from the Photos app

*Select the Share icon

*Select my extension

*See the modified image within my extension

*Select the Share icon

*Select some other extension (Tweetbot, Facebook...)

*See the UI for the other extension begin to appear

*Crash


The crash does not appear for iOS-provided extensions such as saving or printing.  The crash does appear for all third-party extensions I've tried.
I used Instruments to diagnose.  My extension's memory usage briefly peaks at 75MB while doing image operations, then settles down to 27MB.  When the UI begins building for the other extension, my app's memory footprint quickly skyrockets.  It hits 120MB, then dies.
I get three didReceiveMemoryWarning calls during the memory escalation.  The only data I'm holding is the on-screen UIImageView.  I've tried killing that UIImageView at this point (imageView.removeFromSuperview then imageView=nil) with no change in result.
It appears that the secondary extension is loading in my extension's memory, and the combined footprint exceeds the 120MB limit.  Does that make sense?  Is that expected?  
I'll admit the idea of an extension that exists just to temporarily hold data to be shared to another extension might not be common, but it's the best approach I can think of.  The modified data doesn't need to be saved permanently - and might be easily confused by the user if the new version was also in their Photos library.  I've thought about my extension opening my main app to share from there, but that seems to be prevented by design (with some hacks suggested that I haven't tried - see openURL not work in Action Extension).
Any workaround ideas?  Thanks!
