Uploaded image for project: 'Appcelerator - INBOX'
  1. Appcelerator - INBOX
  2. AC-5161

Memory leak in Hello World application

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Component/s: Alloy, Titanium SDK & CLI
    • Labels:
    • Environment:

      Alloy 6.1.2GA
      Android Emulator, Nexus 4
      Android Real Device: Samsung S6

      Description

      I have the following basic Titanium Alloy application:

      index.xml

          <Alloy>
          	<Window class="container">
          		<Label id="label" onClick="doClick">Hello, World</Label>
          	</Window>
          </Alloy>
      

      index.js

          function doClick(e) {
          	Alloy.createController('foo', {}).getView().open();
          }
          
          $.index.open();
      

      foo.xml

          <Alloy>
          	<Window>
          		<View class="container">
          			<Label id="label">Some text in the foo controller!</Label>
          		</View>
          	</Window>
          </Alloy>
      

      foo.js

          $.cleanup = function cleanup() {
            $.destroy();
            $.off();
            $.foo.removeEventListener('close', $.cleanup); // added per @Sharif AbuDarda suggestion
          };
          
          $.foo.addEventListener('close', $.cleanup);
      

      I then monitored the amount of memory the Android emulator was using DDMS, based on the instructions provided here: http://docs.appcelerator.com/platform/latest/#!/guide/Managing_Memory_and_Finding_Leaks

      When the application started the number of objects was: 32,188

      When I click the button, and then close the new window by pressing back, the number of objects increases to: 32,332

      I do this again, it increases to: 32,478

      Open and close the window about 8 more times, and it increases to: 34,481

      and so on.

      The issue is even worse if the window has many objects.

      Note I have tested this on both an Android Emulator (Nexus 4) and a real Android device (Samsung S6).
      This issues seems to occur on 6.1.X GA

      NOTE: I have not yet tested this on iOS yet.

        Attachments

          Activity

            People

            • Assignee:
              shossain Shak Hossain
              Reporter:
              yahya12 Yahya Uddin
            • Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Git Source Code