Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-5352

iOS: Turn on local caching for images

    Details

      Description

      Extensive stress on the system of loading local images can lead to memory warnings and jetsam purges. This is easily demonstrated by constantly setting a badge on an icon which uses a custom image (setting a badge refreshes the tab, which reloads the image). The best way to see this effect cascade is by tying available memory to the badge value via a timer, which will force repeated refreshes.

      SAMPLE APP


      app.js

      Titanium.UI.setBackgroundColor('#000');
      var tabGroup = Titanium.UI.createTabGroup({id:'tabGroup1'});
      var win1 = Titanium.UI.createWindow({backgroundColor:'white'});
       
      var tab1 = Titanium.UI.createTab({
      	icon:'bug.png',
      	window:win1
      });
      setInterval(function() { 
      	tab1.badge = parseInt(Ti.Platform.availableMemory);
      }, 50);
      tabGroup.addTab(tab1);
      tabGroup.open();
      
      

      Ideally, this will be run on device since it is more memory-constrained and jetsam will kill the app. Do NOT fix the side-effects of the caching problem (namely, that tabs are reloaded in this manner).

      TESTING


      The bug is not fixed as long as the badge number on the app goes down. This app is specifically designed to not allocate additional memory beyond the occasional autoreleased value. jetsam won't necessarily terminate, and you may need to watch the app for an extended period of time (several minutes) before seeing decreases of the magnitude that will lead to the badge number fluctuating (indicating allocation/reclamation) or plummeting.

        Attachments

        1. bug.png
          bug.png
          3 kB
        2. localloader.js
          2 kB
        3. remoteloader.js
          1 kB

          Activity

            People

            • Assignee:
              stephentramer Stephen Tramer
              Reporter:
              stephentramer Stephen Tramer
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-4534
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration