[TIMOB-12160] Android: Memory leak on heavy weight windows
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-03-12T05:28:02.000+0000 |
Affected Version/s | Release 3.0.0 |
Fix Version/s | Release 3.1.0, 2012 Sprint 26 API, 2012 Sprint 26 |
Components | Android |
Labels | core, module_memory, qe-testadded |
Reporter | Allen Yeung |
Assignee | Ping Wang |
Created | 2012-12-27T18:19:41.000+0000 |
Updated | 2013-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.
PR: https://github.com/appcelerator/titanium_mobile/pull/3643
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)