Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14498] iOS: Memory Leak issue for property set in tiapp.xml

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionDuplicate
Resolution Date2013-07-22T23:43:15.000+0000
Affected Version/sRelease 2.1.4, Release 3.0.2, Release 3.1.0, Release 3.1.1
Fix Version/s2013 Sprint 15 API, 2013 Sprint 15, Release 3.2.0, Release 3.2.3
ComponentsiOS
Labelsios, mobile, mobilesdk, qe-closed-3.2.3, titanium
ReporterAshish Nigam
AssigneeIngo Muschenetz
Created2013-07-09T09:29:07.000+0000
Updated2014-06-19T12:43:14.000+0000

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 system 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

FileDateSize
Instruments_report.trace2013-07-09T09:29:07.000+0000204
Memory Leak1.png2013-07-09T09:29:07.000+0000251658
Memory Leak2.png2013-07-09T09:29:07.000+0000225222
Memory Leak3.png2013-07-09T09:29:07.000+0000228281

Comments

  1. Vishal Duggal 2013-07-22

    This is a dupe issue and has already been fixed since 3.0.0
  2. Deepti Pandey 2014-04-21

    Verified as FIXED using : OSX: 10.9.2 Xcode:5.1.1 acs@1.0.14 alloy@1.3.1 npm@1.3.2 titanium@3.2.3-beta2 titanium-code-processor@1.1.1-beta1 MobileSDK :3.2.3.v20140418101718 ,3.3.0.v20140418162516 Appcelerator Studio, build: 3.2.3.201404162038 Devices Used : iPhone 5s (7.1) ; iPod touch (7.1) No memory leaks have been noticed by adding system in the default project. Hence closing this ticket as FIXED.

JSON Source