Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10091] Android: Window URL contexts never freed after window has closed.

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-08-23T19:05:43.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sSprint 2012-16 API, Release 3.0.0
ComponentsAndroid
Labelscore, module_window, qe-testadded
ReporterJosh Roesslein
AssigneeJosh Roesslein
Created2012-07-23T12:50:17.000+0000
Updated2013-09-26T10:20:17.000+0000

Description

When opening a window with an "url" script, the context created for this window is never released after the window has been closed. This can lead to memory leaks if the script kept global references to values in that context. See the attached app.js and test.js scripts to reproduce this bug. Create a project with both of these files in the Resources folder. 1. Run application and monitor heap with DDMS. 2. Click "Open Window". 3. Hit the back button to close the window. 4. Repeat steps 2 - 3. Watch the heap size and see if it grows. Actual: Heap size continues to grow in size. Expected: The memory allocated in the new context should be released and eventually collected. Heap size should reach a ceiling and remain stable.

Attachments

FileDateSize
app.js2012-07-23T12:50:43.000+0000297
test.js2012-07-23T12:51:02.000+0000351

Comments

  1. Josh Roesslein 2012-07-23

    This is one of the causes of the memory leak seen in TIMOB-10040.
  2. Josh Roesslein 2012-08-13

    Created [PR #2720](https://github.com/appcelerator/titanium_mobile/pull/2720) to resolve issue.
  3. Shyam Bhadauria 2012-08-29

    Environment used for verification - Tested with Titanium SDK: 2.2.0.v20120828153312 Tested with Titanium  Studio: 2.1.2.201208201549 Device - Android 2.2 emulator Machine OS - MAC 10.8

JSON Source