Details

      Description

      {html}<div><p>Hello. I investigated the memory leak issue. I have such code
      (modified KitchenSink):<br>
      var scrollView = Titanium.UI.createScrollableView({<br></p> <pre> <code>views:[], showPagingControl:true, pagingControlHeight:30, maxZoomScale:2.0, currentPage:1,</code> </pre> <p>});</p>
      <p>var dir =
      Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory+'/hires');<br></p>
      <p>var files = dir.getDirectoryListing();<br></p>
      <p>for(i=0;i<files.length;i++)<br>
      {<br></p>
      <pre>
      <code>var img = Titanium.UI.createImageView({
      backgroundImage:'../hires/'+files[i],
      width:640,
      height:880,
      left:0,
      top:0,
      });

      var scroll = Titanium.UI.createScrollView({ contentWidth:320, contentHeight:440, minZoomScale:0.5, }); scroll.add(img); scrollView.addView(scroll);</code> </pre> <p>}</p>
      <p>win.add(scrollView);<br>
      So I noticed that every Scroll event free memory decreased by
      2-3MB, looks like Titanium creates new view for current focused
      view and there is NO way to release the memory. I don't understand
      why memory consumes when I scroll to new view. All views already
      loaded in that For cycle. I have app crash after 7-8 scrolls on my
      iPhone 3G. 1.3.0 SDK</p></div>{html}

        Activity

        Hide
        gero added a comment -
        {html}<div><p>I can confirm this behaviour. Further information:</p>
        <ul>
        <li>Creating a new context (window.url) does not help to release
        memory on close</li>
        <li>Removing the window, the scrollable view or even every single
        view/image (removeView) on close does not help to release
        memory.</li>
        <li>Setting every view to null or images to a smaller local image
        does not help to release memory on close.</li>
        <li>If you call the scrollable view a second time with the same
        images (even in a new context), (almost) no further memory is
        consumed, which is a hint that the views persist in memory.</li>
        </ul>
        <p>This is a show stopper for every App with a "gallery". Release:
        1.4.0 on iPhone 4.0.1.</p></div>{html}
        Show
        gero added a comment - {html}<div><p>I can confirm this behaviour. Further information:</p> <ul> <li>Creating a new context (window.url) does not help to release memory on close</li> <li>Removing the window, the scrollable view or even every single view/image (removeView) on close does not help to release memory.</li> <li>Setting every view to null or images to a smaller local image does not help to release memory on close.</li> <li>If you call the scrollable view a second time with the same images (even in a new context), (almost) no further memory is consumed, which is a hint that the views persist in memory.</li> </ul> <p>This is a show stopper for every App with a "gallery". Release: 1.4.0 on iPhone 4.0.1.</p></div>{html}
        Hide
        David R. added a comment -
        {html}<div><p>Same problem here.</p></div>{html}
        Show
        David R. added a comment - {html}<div><p>Same problem here.</p></div>{html}
        Hide
        David R. added a comment -
        {html}<div><p>The TiUIImageView.m is missing a [imageView release] at line
        308, I believe:</p>
        <p><a href=
        "http://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/TiUIImageView.m">
        http://github.com/appcelerator/titanium_mobile/blob/master/iphone/C...</a></p></div>{html}
        Show
        David R. added a comment - {html}<div><p>The TiUIImageView.m is missing a [imageView release] at line 308, I believe:</p> <p><a href= "http://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/TiUIImageView.m"> http://github.com/appcelerator/titanium_mobile/blob/master/iphone/C ...</a></p></div>{html}
        Hide
        Stephen Tramer added a comment -
        {html}<div><p>Possibly already resolved by scrollview fixes to load/unload
        memory. Requires R&D.</p></div>{html}
        Show
        Stephen Tramer added a comment - {html}<div><p>Possibly already resolved by scrollview fixes to load/unload memory. Requires R&D.</p></div>{html}
        Hide
        Alan Leard added a comment -
        {html}<div><p>This issue may be causing the application to crash. See ticket
        reference: <a href=
        "http://developer.appcelerator.com/helpdesk/view/73421">http://developer.appcelerator.com/helpdesk/view/73421</a></p>
        <p>Does not crash on iPhone 4. Does Crash on iPad and previous
        versions of iPhone. Does not crash on android.</p>
        <p>Use attached app to test.</p></div>{html}
        Show
        Alan Leard added a comment - {html}<div><p>This issue may be causing the application to crash. See ticket reference: <a href= "http://developer.appcelerator.com/helpdesk/view/73421"> http://developer.appcelerator.com/helpdesk/view/73421 </a></p> <p>Does not crash on iPhone 4. Does Crash on iPad and previous versions of iPhone. Does not crash on android.</p> <p>Use attached app to test.</p></div>{html}
        Hide
        bowman9991 added a comment -
        {html}<div><p>Same here. 20 images on the iPad in a scrollView crashes every
        time, but iPhone works perfectly. Is a fix likely to make it into
        1.6?</p></div>{html}
        Show
        bowman9991 added a comment - {html}<div><p>Same here. 20 images on the iPad in a scrollView crashes every time, but iPhone works perfectly. Is a fix likely to make it into 1.6?</p></div>{html}
        Hide
        Marko Perutovic added a comment -
        {html}<div><p>Any news? This is critical to me!</p></div>{html}
        Show
        Marko Perutovic added a comment - {html}<div><p>Any news? This is critical to me!</p></div>{html}
        Hide
        DanielAndre added a comment -
        {html}<div><p>Same issue here. I am tired to run around this problem. The
        scrollableview is such a basic structure on an IPad. Please, i beg
        you, change this priority to high.</p></div>{html}
        Show
        DanielAndre added a comment - {html}<div><p>Same issue here. I am tired to run around this problem. The scrollableview is such a basic structure on an IPad. Please, i beg you, change this priority to high.</p></div>{html}
        Hide
        DanielAndre added a comment -
        {html}<div><p>Just to add some perspective. This bug is at least 8 months
        old.</p>
        <p><a href=
        "http://developer.appcelerator.com/question/46061/serious-memory-leak">
        http://developer.appcelerator.com/question/46061/serious-memory-leak</a></p></div>{html}
        Show
        DanielAndre added a comment - {html}<div><p>Just to add some perspective. This bug is at least 8 months old.</p> <p><a href= "http://developer.appcelerator.com/question/46061/serious-memory-leak"> http://developer.appcelerator.com/question/46061/serious-memory-leak </a></p></div>{html}
        Hide
        Rick Blalock added a comment -
        {html}<div><p>Traces / Instrument files here.</p>
        <p>Crash Log and Console Log:<br>
        <a href=
        "http://pastie.org/1618663">http://pastie.org/1618663</a><br>
        <a href=
        "http://pastie.org/1618660">http://pastie.org/1618660</a></p></div>{html}
        Show
        Rick Blalock added a comment - {html}<div><p>Traces / Instrument files here.</p> <p>Crash Log and Console Log:<br> <a href= "http://pastie.org/1618663"> http://pastie.org/1618663 </a><br> <a href= "http://pastie.org/1618660"> http://pastie.org/1618660 </a></p></div>{html}
        Hide
        Stephen Tramer added a comment -
        {html}<div><p>There's another HD ticket for this: <a href=
        "http://developer.appcelerator.com/helpdesk/view/64751">http://developer.appcelerator.com/helpdesk/view/64751</a></p></div>{html}
        Show
        Stephen Tramer added a comment - {html}<div><p>There's another HD ticket for this: <a href= "http://developer.appcelerator.com/helpdesk/view/64751"> http://developer.appcelerator.com/helpdesk/view/64751 </a></p></div>{html}
        Hide
        Jeff Haynie added a comment -
        {html}<div><p>(from <a href=
        "/projects/32238/changesets/01937daa0e8379bb256b7b5d1e5a9ce675df397d"
        title=
        "Changeset [01937daa0e8379bb256b7b5d1e5a9ce675df397d]">[01937daa0e8379bb256b7b5d1e5a9ce675df397d]</a>)
        [<a href="/projects/32238/tickets/1441" title=
        "Ticket #1441">#1441</a> state:fixed-in-qa] Scollable view now
        unloads offscreen views. <a href=
        "https://github.com/appcelerator/titanium_mobile/commit/01937daa0e8379bb256b7b5d1e5a9ce675df397d">
        https://github.com/appcelerator/titanium_mobile/commit/01937daa0e83...</a></p></div>{html}
        Show
        Jeff Haynie added a comment - {html}<div><p>(from <a href= "/projects/32238/changesets/01937daa0e8379bb256b7b5d1e5a9ce675df397d" title= "Changeset [01937daa0e8379bb256b7b5d1e5a9ce675df397d] "> [01937daa0e8379bb256b7b5d1e5a9ce675df397d] </a>) [<a href="/projects/32238/tickets/1441" title= "Ticket #1441">#1441</a> state:fixed-in-qa] Scollable view now unloads offscreen views. <a href= "https://github.com/appcelerator/titanium_mobile/commit/01937daa0e8379bb256b7b5d1e5a9ce675df397d"> https://github.com/appcelerator/titanium_mobile/commit/01937daa0e83 ...</a></p></div>{html}
        Hide
        Jeff Haynie added a comment -
        {html}<div><p>(from <a href=
        "/projects/32238/changesets/d000310a5b15c8cc03033617398835732178879d"
        title=
        "Changeset [d000310a5b15c8cc03033617398835732178879d]">[d000310a5b15c8cc03033617398835732178879d]</a>)
        [<a href="/projects/32238/tickets/1441" title=
        "Ticket #1441">#1441</a>] Add adjustable caching to allow rendering
        performance/memory tradeoff. Sometimes the end dev knows best!
        <a href=
        "https://github.com/appcelerator/titanium_mobile/commit/d000310a5b15c8cc03033617398835732178879d">
        https://github.com/appcelerator/titanium_mobile/commit/d000310a5b15...</a></p></div>{html}
        Show
        Jeff Haynie added a comment - {html}<div><p>(from <a href= "/projects/32238/changesets/d000310a5b15c8cc03033617398835732178879d" title= "Changeset [d000310a5b15c8cc03033617398835732178879d] "> [d000310a5b15c8cc03033617398835732178879d] </a>) [<a href="/projects/32238/tickets/1441" title= "Ticket #1441">#1441</a>] Add adjustable caching to allow rendering performance/memory tradeoff. Sometimes the end dev knows best! <a href= "https://github.com/appcelerator/titanium_mobile/commit/d000310a5b15c8cc03033617398835732178879d"> https://github.com/appcelerator/titanium_mobile/commit/d000310a5b15 ...</a></p></div>{html}
        Hide
        Jeff Haynie added a comment -
        {html}<div><p>(from <a href=
        "/projects/32238/changesets/beb41c2c62bf67aac4d990b1d6e61dc31679724f"
        title=
        "Changeset [beb41c2c62bf67aac4d990b1d6e61dc31679724f]">[beb41c2c62bf67aac4d990b1d6e61dc31679724f]</a>)
        [<a href="/projects/32238/tickets/1441" title=
        "Ticket #1441">#1441</a>] Fix for senseless caching values. Hat tip
        to Blain. <a href=
        "https://github.com/appcelerator/titanium_mobile/commit/beb41c2c62bf67aac4d990b1d6e61dc31679724f">
        https://github.com/appcelerator/titanium_mobile/commit/beb41c2c62bf...</a></p></div>{html}
        Show
        Jeff Haynie added a comment - {html}<div><p>(from <a href= "/projects/32238/changesets/beb41c2c62bf67aac4d990b1d6e61dc31679724f" title= "Changeset [beb41c2c62bf67aac4d990b1d6e61dc31679724f] "> [beb41c2c62bf67aac4d990b1d6e61dc31679724f] </a>) [<a href="/projects/32238/tickets/1441" title= "Ticket #1441">#1441</a>] Fix for senseless caching values. Hat tip to Blain. <a href= "https://github.com/appcelerator/titanium_mobile/commit/beb41c2c62bf67aac4d990b1d6e61dc31679724f"> https://github.com/appcelerator/titanium_mobile/commit/beb41c2c62bf ...</a></p></div>{html}
        Hide
        Jeff Haynie added a comment -
        {html}<div><p>(from <a href=
        "/projects/32238/changesets/757143515c9fef46bda05f0a703b179dd360ff66"
        title=
        "Changeset [757143515c9fef46bda05f0a703b179dd360ff66]">[757143515c9fef46bda05f0a703b179dd360ff66]</a>)
        [<a href="/projects/32238/tickets/1441" title=
        "Ticket #1441">#1441</a>] When clearing the views array, actually
        deallocate the views <a href=
        "https://github.com/appcelerator/titanium_mobile/commit/757143515c9fef46bda05f0a703b179dd360ff66">
        https://github.com/appcelerator/titanium_mobile/commit/757143515c9f...</a></p></div>{html}
        Show
        Jeff Haynie added a comment - {html}<div><p>(from <a href= "/projects/32238/changesets/757143515c9fef46bda05f0a703b179dd360ff66" title= "Changeset [757143515c9fef46bda05f0a703b179dd360ff66] "> [757143515c9fef46bda05f0a703b179dd360ff66] </a>) [<a href="/projects/32238/tickets/1441" title= "Ticket #1441">#1441</a>] When clearing the views array, actually deallocate the views <a href= "https://github.com/appcelerator/titanium_mobile/commit/757143515c9fef46bda05f0a703b179dd360ff66"> https://github.com/appcelerator/titanium_mobile/commit/757143515c9f ...</a></p></div>{html}
        Hide
        Rene Aavik added a comment -
        {html}<div><p>Hi,</p>
        <p>I don't think the issue is completely fixed. I am still
        experiencing app crashing when scrolling through a decent number
        number of hi-res images (necessary for my magazine app). Possibly a
        more fundamental issue with Titanium's garbage collecting
        routines?</p></div>{html}
        Show
        Rene Aavik added a comment - {html}<div><p>Hi,</p> <p>I don't think the issue is completely fixed. I am still experiencing app crashing when scrolling through a decent number number of hi-res images (necessary for my magazine app). Possibly a more fundamental issue with Titanium's garbage collecting routines?</p></div>{html}
        Hide
        Rene Aavik added a comment -
        {html}<div><p>I did some additional testing and here's what I discovered:</p>
        <ul>
        <li>When scrolling through a set of images, new images are loaded
        to the cache, but the memory for previous (out of cache range)
        images is not freed, at least until:</li>
        <li>when the available memory is very low (less than 10M on a mac
        running the iOS simulator), which is when GC seems to finally kick
        in and free some of the resources.</li>
        <li>When running on device, GC seems to kick in too late, by that
        time it looks like iOS manages to force-quit the app that is
        gobbling up memory.</li>
        </ul>
        <p>I think the GC system Titanium uses for iOS apps needs some
        major improvements, and this is critical, as these issues make
        Titanium largely unusable for many times of projects.
        Unfortunately, I discovered this way too late (after investing more
        than a month of my time into a project that is almost complete, but
        still completely useless due to these memory issues).</p>
        <p>Developers working on this - please advise when you expect those
        major issues to be fixed? I realize the memory issues are scheduled
        for the 1.7.0 release, but I for one cannot afford to wait a couple
        of months on this, as I'm sure holds true to many others. I would
        even be willing to chip in on the development process to accelerate
        this, even though I am pretty new to Obj-C myself.</p></div>{html}
        Show
        Rene Aavik added a comment - {html}<div><p>I did some additional testing and here's what I discovered:</p> <ul> <li>When scrolling through a set of images, new images are loaded to the cache, but the memory for previous (out of cache range) images is not freed, at least until:</li> <li>when the available memory is very low (less than 10M on a mac running the iOS simulator), which is when GC seems to finally kick in and free some of the resources.</li> <li>When running on device, GC seems to kick in too late, by that time it looks like iOS manages to force-quit the app that is gobbling up memory.</li> </ul> <p>I think the GC system Titanium uses for iOS apps needs some major improvements, and this is critical, as these issues make Titanium largely unusable for many times of projects. Unfortunately, I discovered this way too late (after investing more than a month of my time into a project that is almost complete, but still completely useless due to these memory issues).</p> <p>Developers working on this - please advise when you expect those major issues to be fixed? I realize the memory issues are scheduled for the 1.7.0 release, but I for one cannot afford to wait a couple of months on this, as I'm sure holds true to many others. I would even be willing to chip in on the development process to accelerate this, even though I am pretty new to Obj-C myself.</p></div>{html}
        Hide
        Brian added a comment -
        {html}<div><p>renx - I agree this is not fixed...we are experiencing the same
        issues with the latest build for 1.7. Also this is even worse with
        table views that have a lot of images...big showstoppers.</p></div>{html}
        Show
        Brian added a comment - {html}<div><p>renx - I agree this is not fixed...we are experiencing the same issues with the latest build for 1.7. Also this is even worse with table views that have a lot of images...big showstoppers.</p></div>{html}
        Hide
        Stephen Tramer added a comment -
        {html}<div><p>We will be unable to address these specific issues without
        sample code.</p></div>{html}
        Show
        Stephen Tramer added a comment - {html}<div><p>We will be unable to address these specific issues without sample code.</p></div>{html}
        Hide
        Rene Aavik added a comment -
        {html}<div><p>I'm sorry, I should have posted the sample code. I also forgot
        to specify, that my ScrollableView does not consist of pure
        ImageViews, but instead of Views <strong>containing</strong>
        ImageViews (this is because my design requires there to be two
        images side-by-side in landscape view).</p>
        <p>However, it looks like memory is now being correctly released in
        the latest build of 1.7.0. I suspect the following commit did the
        trick:</p>
        <p><a href=
        "https://github.com/appcelerator/titanium_mobile/commit/b2209783baaee620d7600b7f8ef0117b87321d47">
        https://github.com/appcelerator/titanium_mobile/commit/b2209783baae...</a></p>
        <p>as it seems to correct to properly detach all child views of a
        view being detached. This probably fixes this for situations where
        ImageViews are used as children in the ScrollableView.views
        array.</p>
        <p>I will do some additional testing on device and report back with
        sample code if I discover additional problems in this regard,
        however, for now it seems the memory leak issue has been fixed.</p></div>{html}
        Show
        Rene Aavik added a comment - {html}<div><p>I'm sorry, I should have posted the sample code. I also forgot to specify, that my ScrollableView does not consist of pure ImageViews, but instead of Views <strong>containing</strong> ImageViews (this is because my design requires there to be two images side-by-side in landscape view).</p> <p>However, it looks like memory is now being correctly released in the latest build of 1.7.0. I suspect the following commit did the trick:</p> <p><a href= "https://github.com/appcelerator/titanium_mobile/commit/b2209783baaee620d7600b7f8ef0117b87321d47"> https://github.com/appcelerator/titanium_mobile/commit/b2209783baae ...</a></p> <p>as it seems to correct to properly detach all child views of a view being detached. This probably fixes this for situations where ImageViews are used as children in the ScrollableView.views array.</p> <p>I will do some additional testing on device and report back with sample code if I discover additional problems in this regard, however, for now it seems the memory leak issue has been fixed.</p></div>{html}
        Hide
        Kevin (WA) added a comment -
        {html}<div><p>Forgive me, but how are you downloading "the latest build of
        1.7.0" ? I only see the latest nightly/continuous build here:
        <a href=
        "http://builds.appcelerator.com.s3.amazonaws.com/index.html">http://builds.appcelerator.com.s3.amazonaws.com/index.html</a></p></div>{html}
        Show
        Kevin (WA) added a comment - {html}<div><p>Forgive me, but how are you downloading "the latest build of 1.7.0" ? I only see the latest nightly/continuous build here: <a href= "http://builds.appcelerator.com.s3.amazonaws.com/index.html"> http://builds.appcelerator.com.s3.amazonaws.com/index.html </a></p></div>{html}
        Hide
        Stephen Tramer added a comment -
        {html}<div><p>You are able to download and build from our github repository:
        <a href=
        "http://github.com/appcelerator/titanium_mobile">http://github.com/appcelerator/titanium_mobile</a>.</p></div>{html}
        Show
        Stephen Tramer added a comment - {html}<div><p>You are able to download and build from our github repository: <a href= "http://github.com/appcelerator/titanium_mobile"> http://github.com/appcelerator/titanium_mobile </a>.</p></div>{html}
        Hide
        Kevin (WA) added a comment -
        {html}<div><p>ok, is the github "master" branch considered 1.7.0-continuous at
        the moment?</p></div>{html}
        Show
        Kevin (WA) added a comment - {html}<div><p>ok, is the github "master" branch considered 1.7.0-continuous at the moment?</p></div>{html}
        Hide
        Stephen Tramer added a comment -
        {html}<div><p>Yes. Master is the latest and should be considered unstable and
        not generally suitable for release software, unless you absolutely
        require fixes from it.</p></div>{html}
        Show
        Stephen Tramer added a comment - {html}<div><p>Yes. Master is the latest and should be considered unstable and not generally suitable for release software, unless you absolutely require fixes from it.</p></div>{html}
        Hide
        Thomas Huelbert added a comment -

        [INFO] Titanium SDK version: 1.7.0 (05/10/11 19:34 879871b...), ipad1 4.2. 3 minutes an a ton of scrolls, not a leak seen using instruments.

        Show
        Thomas Huelbert added a comment - [INFO] Titanium SDK version: 1.7.0 (05/10/11 19:34 879871b...), ipad1 4.2. 3 minutes an a ton of scrolls, not a leak seen using instruments.

          People

          • Assignee:
            Pedro Enrique
            Reporter:
            Vitaly Virulaine
          • Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development