Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Medium
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: Release 1.7.0
-
Component/s: iOS
-
Labels:
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}
(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}