title: iOS Keyboard Extension terminated with "per-process-limit"
body: <p>I am trying to develop a Keyboard Extension for iOS 8. Apart from various problems I had (which make it obvious that extensions are just an after-thought), after starting to test on an iPhone 6, I found out that the extension is randomly terminated with the crash log having an entry such as this:</p>
  
  <pre><code> Name       |            &lt;UUID&gt;                |     CPU Time|     rpages|       purgeable| recent_max| lifetime_max| fds |  [reason]         | (state)
   MyKeyboard &lt;93dea1cc8757387ba5e7da3006a7d23f&gt;         0.638       13072                0           -          8483   50  [per-process-limit]  (frontmost)
  </code></pre>
  
  <p>Notice that this happens on the iPhone 6 and iPhone 6 plus, but doesn't happen with the less powerful (with less RAM, but not 64bit) iPhone 4S.</p>
  
  <p>Of course it does not happen when you are debugging on the device.</p>
  
  <p>Also, it does not happen if I run the exact same code as an app instead of an extension.</p>
  
  <p>The terminations seem to happen mostly when there are lines drawn with Quartz or, even more easily, with attributed strings rendered as arcs, using a derivative of Apple's CoreTextArcCocoa class.
  The profiler shows that there is never CPU usage, RAM usage in the app is a modest 15-25MB. There are many allocations/deallocations when I use several of those arc text views (mostly related to attributed strings), so I am thinking perhaps quick allocations (even if they are followed by deallocations) trigger some iOS process that terminates the extension for fear of taking up too much RAM? But how to code around it if I don't know the exact trigger? And of course I can't think of a way to debug this issue, as it is outside my app.
  I tried opening a ticket with Apple about it, using one of my developer program tickets. I asked for any kind of help, even just a better explanation of that "per-process-limit". They closed and refunded it without response. I reopened asking at least a reason for closing the first ticket, they closed that and refunded as well.
  Any ideas about what exactly is going on or what I could try?</p>
  
  <p>For reference here is the full mem stats from the same crash log:</p>
  
  <pre><code>Free pages:                              9054
  Active pages:                            122754
  Inactive pages:                          48617
  Speculative pages:                       235
  Throttled pages:                         0
  Purgeable pages:                         4696
  Wired pages:                             67788
  File-backed pages:                       81292
  Anonymous pages:                         90314
  Compressions:                            15775
  Decompressions:                          3940
  Compressor Size:                         1364
  Uncompressed Pages in Compressor:        4383
  Page Size:                               16384
  Largest process:   backboardd
  </code></pre>