Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My app crashes and closes down and there is very little information as to why

I have a crash and would greatly appreciate some advice on how to find and fix the problem. The Game simply shuts downs. When the app is attached and running in the debugger, there is no debug output to say why like with a 'normal' crash. I know it happens after a LoadView because an NSLog at the end of LoadView is the last output, on the same screen every time. Below is the limited crash report form Organizer ('unknown' process I think because it was running in the debugger?) This has only started happening on ios6. There are apparently no memory leaks according to the instrument though I'm not sure I entirely trust it. The crash tends to happen when you play the game for a while and go back and forth through the screens so it feels like a leak. However the fact it is always when returning to the same screen suggests it's a problem with that view controller. I don't know what rpages is exactly and I don't know if 90974 is too big.

Incident Identifier: 7D34217C-9F8E-49B0-B399-1F5573355F31
CrashReporter Key:   29ce6ea76874d5a03d826014a1f50e1a2160db41
Hardware Model:      iPhone3,1
OS Version:          iPhone OS 6.0 (10A403)
Kernel Version:      Darwin Kernel Version 13.0.0: Sun Aug 19 00:27:34 PDT 2012; root:xnu-2107.2.33~4/RELEASE_ARM_S5L8930X
Date:                2012-10-30 22:48:15 -0700
Time since snapshot: 206 ms

Free pages:        958
Active pages:      2673
Inactive pages:    2118
Throttled pages:   101092
Purgeable pages:   0
Wired pages:       22186
Largest process:   MyCrashingApp

Processes
 Name                    <UUID>                       rpages       recent_max       [reason]          (state)

  MobileMail <bff817c61ce33c85a43ea9a6c98c29f5>         1165             1165         [vm]         (resume) (continuous)
  MobilePhone <3fca241f2a193d0fb8264218d296ea41>        898              898         [vm]         (resume) (continuous)
  tccd <eb5ddcf533663f8d987d67cae6a4c4ea>               119              119         [vm]         (daemon)
  MyCrashingApp <f6c54a2392523abe8745d853870bf985>      90974            90974         [vm]         (audio) (frontmost) (resume)
  ptpd <04a56fce67053c57a7979aeea8e5a7ea>               665              665                      (daemon)
  locationd <892cd1c9ffa43c99a82dba197be5f09e>          1237             1237                      (daemon)
  dataaccessd <2a3f6a518f3f3646bf35eddd36f25005>        614              614                      (daemon)
  mediaserverd <80657170daca32c9b8f3a6b1faac43a2>       1316             1316                      (daemon)
  syslogd <cbef142fa0a839f0885afb693fb169c3>            139              139                      (daemon)
  wifid <9472b090746237998cdbb9b34f090d0c>              284              284                      (daemon)
  iaptransportd <f784f30dc09d32078d87b450e8113ef6>      192              192                      (daemon)
  SpringBoard <27372aae101f3bbc87804edc10314af3>        3477             3477                     
  backboardd <5037235f295b33eda98eb5c72c098858>         9957             9957                      (daemon)
  aggregated <8c3c991dc4153bc38aee1e841864d088>         75               75                      (daemon)
  BTServer <c92fbd7488e63be99ec9dbd05824f5e5>           198              198                      (daemon)
  configd <4245d73a9e96360399452cf6b8671844>            897              897                      (daemon)
  fairplayd.N90 <3ac48d9cfb143757bccce4fe6c154533>      135              135                      (daemon)
  fseventsd <996cc4ca03793184aea8d781b55bce08>          315              315                      (daemon)
  imagent <1e68080947be352590ce96b7a1d07b2f>            528              528                      (daemon)
  mDNSResponder <3e557693f3073697a58da6d27a827d97>      237              237                      (daemon)
  lockdownd <ba1358c7a8003f1b91af7d5f58dd5bbe>          207              207                      (daemon)
  powerd <2d2ffed5e69638aeba1b92ef124ed861>             123              123                      (daemon)
  UserEventAgent <6edfd8d8dba23187b05772dcdfc94f90>     427              427                      (daemon)
  debugserver <185719f06f1631d4922c652bdd4c8529>        0                0                      (daemon)
  gputoolsd <889065a15ba8372ca533e023c10bd776>          0                0                      (daemon)
  springboardservi <ff6f64b3a21a39c9a1793321eefa5304>   0                0                      (daemon)
  syslog_relay <45e9844605d737a08368b5215bb54426>       0                0                      (daemon)
  syslog_relay <45e9844605d737a08368b5215bb54426>       0                0                      (daemon)
  DTMobileIS <23303ca402aa3705870b01a9047854ea>         0                0                      (daemon)
  afcd <b0aff2e7952e34a9882fec81a8dcdbb2>               120              120                      (daemon)
  notification_pro <845b7beebc8538ca9ceef731031983b7    118              118                      (daemon)
  filecoordination <fbab576f37a63b56a1039153fc1aa7d8>   115              115                      (daemon)
  distnoted <a89af76ec8633ac2bbe99bc2b7964bb0>          101              101                      (daemon)
  apsd <94d8051dd5f5362f82d775bc279ae608>               280              280                      (daemon)
   networkd <0032f46009f53a6c80973fe153d1a588>          147              147                      (daemon)
   CommCenterClassi <c82f228b14a830cdb88e3cc1068330b3>  616              616                      (daemon)
   notifyd <51c0e03da8a93ac8a595442fcaac531f>           167              167                      (daemon)
   ReportCrash <8c32f231b2ed360bb151b2563bcaa363>       135              135                      (daemon)

End

like image 843
David John Avatar asked Oct 31 '12 06:10

David John


1 Answers

Your app is crashing because Jetsam (a.k.a memorystatus), which is iOS's low memory condition handler, kills it (this is similar to Linux's OOM and Android's LowMemory Killer). What you are seeing is the memory snapshot. Allow me to explain:

Free pages:        958  - how much free physical memory (in multiples of 4K)
Active pages:      2673 - how many pages in physical memory have recently been used
Inactive pages:    2118 - how many pages in physical memory have NOT recently been used
Throttled pages:   101092 - how many pages are subject to throttling (long story, irrelevant here)
Purgeable pages:   0      - how many pages can be kicked out, on low memory condition  
Wired pages:       22186  - how many pages are resident locked, mostly for kernel purposes, or shared libraries

Your app has the unfortunate and dubious honor of having the most resident memory (by orders of magnitude, compared to others). So when the low memory condition occurs - some app wanting to malloc() a large chunk, and not enough free pages remain - Jetsam simply chooses the top memory and -- boom. Kill -9. Hence, no debug dump, etc. iOS has no swap, so there's no way to dump processes on the swap to clear up memory. The only way is out. Death.

What you can do about it:

Before Jetsam kills you, there is usually a low memory notification via an event, which the Obj-C runtime translated into the -didReceiveMemoryWarning. So handle it. From what you're describing, you might also want to release the UIViews. Those consume a LOT of memory.

like image 77
Technologeeks Avatar answered Sep 19 '22 19:09

Technologeeks