Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-14498

iOS: Memory Leak issue for property set in tiapp.xml



      Whenever i set any property in tiapp.xml, application reports a memory leak when analyzed using Instrument.

      Steps to reproduce:

      1: Create a sample application and either cloud enable this or set
      any property like this in the tiapp.xml

      <property name="ti.ui.defaultunit">system</property>

      2: Build the application using titanium studio.
      3: analyze the application using instrument for memory leaks.
      4: after few seconds, instrument will show memory leaks.
      5: check the source file for leak.
      6: ApplicationDefault.m will be reported for leaks.
      6: Code written there and responsible for leak is:

      @implementation ApplicationDefaults
      + (NSMutableDictionary*) copyDefaults
          NSMutableDictionary * _property = [[NSMutableDictionary alloc] init];
          [_property setObject:[TiUtils stringValue:@"system"] forKey:@"ti.ui.defaultunit"];
          return _property;


      Possible Solution:

      As per my understanding and finding, dictionary object should have been autoreleased while creating, so the above sample must have been written like:

      @implementation ApplicationDefaults
      + (NSMutableDictionary*) copyDefaults
          NSMutableDictionary * _property = [[[NSMutableDictionary alloc] init] autorelease];
          [_property setObject:[TiUtils stringValue:@"system"] forKey:@"ti.ui.defaultunit"];
          return _property;


        1. Instruments_report.trace
          0.2 kB
        2. Memory Leak1.png
          Memory Leak1.png
          246 kB
        3. Memory Leak2.png
          Memory Leak2.png
          220 kB
        4. Memory Leak3.png
          Memory Leak3.png
          223 kB

          Issue Links



              • Assignee:
                ingo Ingo Muschenetz
                anigam Ashish Nigam
              • Watchers:
                0 Start watching this issue


                • Created:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    Sync status:
                    Last received:
                    Last sent:

                    Git Source Code