title: iOS app crashes, xcode says 'Lost connection to X's iPhone' when debugging
body: <p>My app crashes and I need some advice to find and fix the problem. It is not a device or cable problem because it happens with all devices and not only when debugging. Xcode won't stop on an exception breakpoint the app just simply stops running with no error information. When debugging xcode only says 'Lost connection to X's iPhone'. I have the following log from the device, see MY_CRASHING_APP:</p>
  
  <pre><code>Incident Identifier: 85730E97-BA21-4C72-8AD1-02075A8FD9A7
  CrashReporter Key:   d9e9eb14ac1801fea11e662a394244d7caf29154
  Hardware Model:      iPhone4,1
  OS Version:          iPhone OS 8.0 (12A365)
  Kernel Version:      Darwin Kernel Version 14.0.0: Tue Aug 19 15:08:02 PDT 2014; root:xnu-2783.1.72~8/RELEASE_ARM_S5L8940X
  Date:                2014-09-24 15:02:41 +0200
  Time since snapshot: 325 ms
  
  Free pages:                              20793
  Active pages:                            20412
  Inactive pages:                          10678
  Speculative pages:                       1757
  Throttled pages:                         55906
  Purgeable pages:                         699
  Wired pages:                             21196
  File-backed pages:                       30263
  Anonymous pages:                         2584
  Compressions:                            76385
  Decompressions:                          3948
  Compressor Size:                         81
  Uncompressed Pages in Compressor:        61
  Page Size:                               4096
  Largest process:   MY_CRASHING_APP
  
  Processes
       Name       |            &lt;UUID&gt;                |     CPU Time|     rpages|       purgeable| recent_max| lifetime_max| fds |  [reason]         | (state)
  
         coreduetd &lt;675ac3d39b193f9bba42896818431859&gt;         0.049         124                0           -           391   50     [vnode-limit]     (daemon) (idle)
             homed &lt;77bcbc47e2723e269b0ff9d115658259&gt;         0.052         146                0           -           458   50     [vnode-limit]     (daemon) (idle)
             gamed &lt;a51b1ad16b693a75aeaaf2166e7b1b0b&gt;         0.049          38                0           -            74   50     [vnode-limit]     (daemon) (idle)
               lsd &lt;72b4494834d3357bb8aa32fd5b5c8e83&gt;         0.068         161                0           -           368   50     [vnode-limit]     (daemon)
     InCallService &lt;88e149874b1c35f2b8adbeee958d7258&gt;        18.461        1289                0           -          3238   50     [vnode-limit]     (resume) (continuous)
   MY_CRASHING_APP &lt;1542054cd5393df29827ca1a6bd34e04&gt;        59.116       24504              600           -         29490 1600     [vnode-limit]     (frontmost) (resume)
              ptpd &lt;c0bc1e573edb3bcebea0f3140a139421&gt;         3.442         878                0           -          1634   50                       (daemon)
          BTServer &lt;1b7372b3ae393847b1c3ccaa720e991e&gt;         3.057         393                0           -          1437   50                       (daemon)
         lockdownd &lt;bb602fb4b5ac3b51af2d22c4fdce9778&gt;        11.306         271                0           -           761   50                       (daemon)
           imagent &lt;01ebc2c08d7f36059714967efaa86e78&gt;        19.892         585                0           -          1286   50                       (daemon)
         locationd &lt;9727e24fbe4f357cb27d7bc8cf882c93&gt;       489.694        1665                0           -          3586   50                       (daemon)
  identityservices &lt;13c2b979d6433252a011087be05e1aa5&gt;        22.999         696                0          +2          1585   50                       (daemon)
        discoveryd &lt;dff5d0d2edf43b45b0c7fbd4a3e1b677&gt;        93.758         589                0           -          1077  100                       (daemon)
             wifid &lt;5fb79228aa653a9bb725217b9cb891e6&gt;        63.420         571                0           -          1098   50                       (daemon)
     iaptransportd &lt;ae70565455de38f3aab8993e9d109207&gt;         7.713         306                0           -           579   50                       (daemon)
      mediaserverd &lt;b5ba58774a853d43a17559ae76a6f918&gt;       649.476        1025               64           -          6134   50                       (daemon)
           syslogd &lt;a5a138dc01cd34d19bbe336c03099ce7&gt;        40.100         201                0           -           384   50                       (daemon)
            powerd &lt;b3163caaebd53f7aa42634836472ea04&gt;        43.199         231                0           -           474   50                       (daemon)
              apsd &lt;17af2320ccfb3e668b6455b95b4612ce&gt;        37.461         631                0           -          1445   50                       (daemon)
          networkd &lt;a657abe0ce803333b886876a8f7a36e0&gt;        77.271         596                0           -          1297   50                       (daemon)
       dataaccessd &lt;db655c44d5c830dc9e5f34f7edcb17a4&gt;       243.259        1777                0           -          3097  100                       (daemon)
               vmd &lt;88cebb23d0f1344db23e1896b1787f2d&gt;         0.505         204                0           -           617   50                       (daemon)
              iapd &lt;e84bb9b7cf7530babc36c6ca37b7f345&gt;        11.963         453                0           -          1673   50                       (daemon)
      syslog_relay &lt;9e18dbcbcc07374e9d14c732b8dabad2&gt;         1.424          98                0           -           189   50                       (daemon)
            voiced &lt;2d24fa3e32533f2f8298743eaf348d63&gt;         0.179         210                0           -           581   50                       (daemon)
      itunesstored &lt;d50d5b1c3f693694a2eee878aae8facf&gt;         0.573         908                0           -          1759   50                       (daemon)
       SpringBoard &lt;3e0aacaca7103aa09a71e5c9fee3e012&gt;       841.081        7088               29           -         16912   50                      
        backboardd &lt;117d65aca8ce3ba68c7fd87d9ab81da6&gt;      3424.058        6678              625           -          4409   50                       (daemon)
    UserEventAgent &lt;2f6c74a697943aed899faebac621e4c3&gt;       316.816         848                0           -          2101  200                       (daemon)
           configd &lt;64e4db8bced23463b446c4b7c868fcfa&gt;        31.906         416                0           -           933   50                       (daemon)
         fseventsd &lt;a393d343a7533860b5c1eddb922a33f1&gt;        20.088         405                0           -           805   50                       (daemon)
      fairplayd.H1 &lt;c3856f0573fb3f9887721a239507f28b&gt;        30.647         159                0           -          1096   50                       (daemon)
        assertiond &lt;032107d4db2b36ddac986060d8c62f73&gt;        26.282         289                0           -           702   50                       (daemon)
     wirelessproxd &lt;ba82fe3b38f63f2b8b8807a2bf97aadd&gt;         1.071         179                0           -           643   50                       (daemon)
         distnoted &lt;e8f9e76e751838a880dad2d4a953f814&gt;         4.457         193                0           -           254   50                       (daemon)
  discoveryd_helpe &lt;84abc0c6dd5b37a8b2c8323881e16da7&gt;         0.493         123                0           -           466   50                       (daemon)
               ubd &lt;5f4f0054821e3b41b543a4d9f4176291&gt;         9.040         730                0           -          1540   50                       (daemon)
  filecoordination &lt;68a3848887853629adae42f5828a5443&gt;         2.731         251                0           -           649  100                       (daemon)
        aggregated &lt;ab0d307a392f36cc827709d24c4b8696&gt;      1335.558        1081                0           -          1688   50                       (daemon)
        DTMobileIS &lt;086152f142ac30a686a172b148d38fbc&gt;       109.156         474                0           -          1724   50                       (daemon)
       touchsetupd &lt;d8aabe65f2d23f6ab7704bbccc6c2ba1&gt;         0.388         158                0           -           464   50                       (daemon)
          cfprefsd &lt;6e5dcfe209183c719091d07edad590da&gt;         0.150         166                0           -           320   50                       (daemon)
         accountsd &lt;9eb0309b021033c6b24ce65da48fa228&gt;         0.665         595                0           -          1909   50                       (daemon)
        CommCenter &lt;0e1ced0eddce346ba27e9f54886ef025&gt;       669.306        1543                0           -          4623   50                       (daemon)
           notifyd &lt;7beaf472572334d4989a40473776f635&gt;        61.698         272                0           -           309   50                       (daemon)
       ReportCrash &lt;b36d5780860a3dfcbb146b2cc6bca339&gt;         0.062         146                0           -           443   50                       (daemon)
  
  **End**
  </code></pre>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>It turned out to be a memory issue. The app was allocating a lot of memory very quickly and the OS terminated the app. It was strange that Xcode did not log a memory warning while in Instruments show that the app received a LOT of warnings. Other apps that used the same amount of memory got away with no memory warnings. My guess is that those were not allocating memory at such a fast rate.</p>
  
  <p>The app was running on an iPhone 4S and it got killed at around 90MB memory usage.</p>
  
  <p>What confused me is other out of memory issues all had <code>Purgeable pages: 0</code>. So I'm guessing this is not exactly an out of memory but too much memory usage in a short time?</p>