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

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

    Details

      Description

      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;
      }
      @end
      

      .

      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;
      }
      @end
      

        Attachments

        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

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Source Code