Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12160] Android: Memory leak on heavy weight windows

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2013-03-12T05:28:02.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sRelease 3.1.0, 2012 Sprint 26 API, 2012 Sprint 26
ComponentsAndroid
Labelscore, module_memory, qe-testadded
ReporterAllen Yeung
AssigneePing Wang
Created2012-12-27T18:19:41.000+0000
Updated2013-06-11T23:15:43.000+0000

Description

There was a memory leak caused by the new bubbling implementation, TIMOB-10463 (Timob-11439 was built on top of this bug as well). It looks like windows are not being cleaned up correctly. Steps to reproduce: 1. Run the following code:

function openWindow() {
  var win = Ti.UI.createWindow({
    fullscreen: false,
    backgroundColor: 'red'
  });
  win.open();
  win.buffer = Ti.createBuffer({length: 250 * 1024});
  return win;
}
 
var win = Ti.UI.createWindow({
  layout: 'vertical'
});
 
var openButton = Ti.UI.createButton({
  title: 'Open Window'
});
win.add(openButton);
 
openButton.on('click', function() {
  openWindow();
});
 
win.open();
2. Add the following code in your tiapp.xml:
    <android xmlns:android="http://schemas.android.com/apk/res/android">
        <manifest>
            <application android:debuggable="true"/>
        </manifest>
    </android>
3. Launch the app 4. Hit open window 5. Hit back and watch the allocated memory grow in DDMS 6. Do steps 4&5 at least 5-6 times Expected result: The memory should get cleaned up, and you shouldn't see it grow and grow. Actual Result: The memory continues to grow even when you back out of the window.

Comments

  1. Ping Wang 2012-12-27

    PR: https://github.com/appcelerator/titanium_mobile/pull/3643
  2. Satyam Sekhri 2013-01-03

    Memory gets cleaned up on closing the heavyweight window (de-allocation noticed after opening and closing it 2-3 times) Verified on: Titanium Studio: 3.0.1.201212181159 Titanium SDK: 3.1.0.v20130102102603 Android Device: Nexus 7 (v4.1)

JSON Source