0

I've become frustrated enough to beg for some insights from the mob. I have an application that using MapKit, on tap it shows a thumbnail, and on tap of the thumbnail it shows a photo gallery of images. All the images are using SDWebImage. I've looked at my allocation tables and see that the map alone is using a ton of memory. It peaks at around 60mbs, kind of crazy. When I open the gallery it drops to around 40/35mbs. I can look at one gallery just find, but as soon as I open up a second gallery and start scrolling it crashes, even though the memory use is around 35mbs.

My first attempts at combating this where to purge the WebImage cache on didReceiveMemWarning, second was to actually remove the map and all annotations. The app is using ARC.

Here is the question... How can I fix this? Get this to stop with the memory crash. Any help?

Crash Report

Free pages:        1188
Active pages:      6757
Inactive pages:    4192
Throttled pages:   89007
Purgeable pages:   0
Wired pages:       26699
Largest process:   DbConnect

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

accountsd <e6ceba0e6e053a3ea02d0a916903cff8>          284              284         [vm]         (daemon) (idle)
    installd <117f65beb8cb38da8e0844256c65e402>          301              301         [vm]         (daemon) (idle)
networkd_privile <cd5f76fd767c31428f411ecf03540546>          115              115         [vm]         (daemon) (idle)
         lsd <566268cf717b335e98ddba10ca9315ab>          265              265         [vm]         (daemon) (idle)
  MobileMail <e07ca7a7280736c7bf301451f89d1c02>         1022             1022         [vm]         (resume) (continuous)
 MobilePhone <51866c9bc9f93c9d8526e8acf9efc64c>          998              998         [vm]         (resume) (continuous)
        tccd <2778744d99a530c9a7d5e57a19b60008>          161              161         [vm]         (daemon)
   DbConnect <f628b610fcc23c559f2a96959ac78b15>        21523            21523         [vm]         (frontmost) (resume)
        ptpd <096297a7a40f318290a972274cc44d87>          591              591                      (daemon)
       wifid <72eda25ccdd737a79d6cd172e9bf99a5>          615              615                      (daemon)
     syslogd <da215e2d3de133bf8f52590727b9bdfe>          270              270                      (daemon)
  aosnotifyd <47126a998bb5308f9d5cbe028dc47d60>          447              447                      (daemon)
   locationd <137100f254373daeb894f665c413f8b0>         1023             1023                      (daemon)
iaptransportd <9b3cf56b4db13761bbd8ac2e0ff099be>          242              242                      (daemon)
 dataaccessd <abc7f74d5d683d4c9a04e7ade5b1126b>         1835             1835                      (daemon)
mediaserverd <af72564bf8713fb8b16ee64c5ee85568>         1645             1645                      (daemon)
 SpringBoard <bd1d77d154ef3dffbb53d89337c8a08f>         4057             4057                     
  backboardd <e1dc74434e0e3938b17ff0f7ad85d138>         9463             9463                      (daemon)
   lockdownd <a123aa04ddf83a5fae8e5bc08f0b5771>          260              260                      (daemon)
      powerd <63673a83ac9c3cf98fdc75df8ba70fd0>          156              156                      (daemon)
mDNSResponder <1e651badfb7033a68a73a667ec480a08>          247              247                      (daemon)
UserEventAgent <7ee3410c25e4372d84e93318fe42696b>          534              534                      (daemon)
syncdefaultsd <a18b8aeea66e3ebb9ab0d54e55c1b9d1>          263              263                      (daemon)
  DTMobileIS <0e7e02810e383e2c9ebc212d94b6044f>            0                0                      (daemon)
mobile_profile_j <9e3c8e8611da3c68af7e5511500256de>          194              194                      (daemon)
springboardservi <438ae856a1c039a197e6987a99a8b9b6>            0                0                      (daemon)
syslog_relay <ee47daae952636649230d38b3dc5c2e0>            0                0                      (daemon)
        afcd <3bd960d39c9f3972a10923db0e687b4a>          152              152                      (daemon)
notification_pro <08df322fbe7739199f78852a511169ef>          136              136                      (daemon)
   absinthed <b5e167e1b2dc3bf9b5f704afb30aed5f>          105              105                      (daemon)
filecoordination <28ca39773e933ed2aa92c117c661d056>          164              164                      (daemon)
        apsd <5be27dc5ea5234319bc4b47380e42174>          342              342                      (daemon)
   distnoted <699b8253736233b29180419f139e8c01>          121              121                      (daemon)
    networkd <49064febbe553338bd98051399022da4>          182              182                      (daemon)
  aggregated <c5a375854c3c31d59548ab53ea86d194>           93               93                      (daemon)
   fseventsd <3ea853cb95de3aa48972aa42637af69a>          344              344                      (daemon)
    BTServer <af0150d5085e326598edff072a23d146>          243              243                      (daemon)
     imagent <2b64c6111aa63b179a15afd6a76a6696>          387              387                      (daemon)
     configd <b6a4d70640b63e8f82e0e9f3d6ee2bb9>          510              510                      (daemon)
fairplayd.P106 <c5ca0bc497013131a5c17a89fdedcd82>          175              175                      (daemon)
        geod <d180dd46c4bd3ffbb856b5eb8589a45c>          296              296                      (daemon)
  CommCenter <cb877b4411ee3a348ec44c02ff3da38d>          608              608                      (daemon)
     notifyd <67a17b0c297e3785a9e09b8e72f3636a>          188              188                      (daemon)

Allocation Graph Allocation Graph

Allocation Table Allocation Table

zquintana
  • 371
  • 2
  • 5
  • 13

1 Answers1

1

I figured this out on my own. In case any one else runs into this I'll explain. The solution was actually very simple. I was using a CocoaPod called UIPhotoGallery. That was the problem. Something in it was causing the memory not to be released. I didn't bother trying to fix it. Instead I found another one that worked better. We're using MWPhotoBrowser now (https://github.com/mwaterfall/MWPhotoBrowser). Works like a charm and it wasn't too difficult to setup.

In case anyone else is looking for a gallery library I tried:

  • ios-KRImageViewer
  • Nimbus
  • GVPhotoBrowser
  • UIPhotoGallery

All of which were either too complicated, lacked documentation, or didn't work good. I hope this helps others.

zquintana
  • 371
  • 2
  • 5
  • 13