Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Android: ImageView leaks Memory?

$
0
0

Hi,

I've been hunting a memory leek in the last days and it appears to be a leak in Titanium. But I am not 100% sure, maybe I am doing something wrong?

var rootWin = Ti.UI.createWindow({backgroundColor: 'white'});
rootWin.addEventListener('click', openGraph);
rootWin.open();
 
function openGraph() {
    var win = Ti.UI.createWindow({backgroundColor: 'white'});
 
    var imageView = Ti.UI.createImageView({image: 'http://demo.piwik.org/index.php?module=API&method=ImageGraph.get&idSite=3&apiModule=VisitsSummary&apiAction=get&token_auth=anonymous&period=day&date=2013-06-16,2013-07-15&filter_sort_column=nb_visits&column=nb_visits&columns=nb_visits&language=de&width=600&height=920&aliasedGraph=1&legendAppendMetric=0&backgroundColor=efefef&gridColor=dcdcdc&colors=cb2026&legendFontSize=18&cacherand=4260271&showMetricTitle=1&showLegend=1&legendAppendMetric=1'});
    win.add(imageView);
 
    win.addEventListener('androidback', function () {
        win.close();
        win = null;
        imageView = null;
    });
 
    win.open();
}
When testing the above code example with Titanium 3.1.1.GA or latest Titanium build the app uses 11MB memory. After clicking on the window the graph/image opens and the memory usage goes up to 12.4MB. When pressing the back button the memory usage shrinks to 12MB. But I expected 11MB.

I've tested it on a Samsung Galaxy S2 with Android 4.1.2. I've built the app on a MacOSX 10.8.4 with latest Titanium Studio.

Here's a part of my tiapp.xml

<android xmlns:android="http://schemas.android.com/apk/res/android">
        <tool-api-level>14</tool-api-level>
        <manifest android:installLocation="preferExternal"
            android:versionCode="1" android:versionName="1.0.0">
            <application android:debuggable="true" android:theme="@android:style/Theme.Holo.Light.DarkActionBar"/>
            <supports-screens android:anyDensity="true"
                android:largeScreens="true" android:normalScreens="true"
                android:smallScreens="true" xlargeScreens="true"/>
            <uses-sdk android:installLocation="preferExternal"
                android:minSdkVersion="14" android:targetSdkVersion="14"/>
        </manifest>
    </android>
Thx for your help

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>