Skip to content

A few leaks found #1

@kgn

Description

@kgn

First, a big thanks for this code!!
After running my app through Instruments, I found a few leaks. Below is the info I extracted from Instruments. Let me know if you need anything else.
LEAKED OBJECT: Malloc 16 bytes EVENT TYPE: Malloc RESPONSIBLE CALLER: [InAppSettingsReaderRegisterDefaults loadFile]

  • (void)loadFile:(NSString *)file{ if the file is not in the files list we havn't read it yet NSInteger fileIndex = [self.files indexOfObject:file]; if(fileIndex == NSNotFound){ [self.files addObject:file];
    load plist NSDictionary *settingsDictionary = [[NSDictionary alloc] initWithContentsOfFile:InAppSettingsFullPlistPath(file)]; NSArray *preferenceSpecifiers = [settingsDictionary objectForKey:InAppSettingsPreferenceSpecifiers]; NSString *stringsTable = [settingsDictionary objectForKey:InAppSettingsStringsTable];
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; for(NSDictionary *eachSetting in preferenceSpecifiers){ InAppSettingsSpecifier *setting = [[InAppSettingsSpecifier alloc] initWithDictionary:eachSetting andStringsTable:stringsTable]; if([setting isValid]){ if([setting isType:InAppSettingsPSChildPaneSpecifier]){ [self loadFile:[setting valueForKey:InAppSettingsSpecifierFile]]; }else if([setting hasKey]){ if([setting valueForKey:InAppSettingsSpecifierDefaultValue]){ [self.values setObject:[setting valueForKey:InAppSettingsSpecifierDefaultValue] forKey:[setting getKey]]; } } } [setting release]; } [pool drain]; [settingsDictionary release]; } }
    LEAKED OBJECT: NSCFDictionary EVENT TYPE: Malloc RESPONSIBLE CALLER: [InAppSettingsReaderRegisterDefaults init]
  • (id)init{ self = [super init]; if (self != nil) { self.files = [[NSMutableArray alloc] init]; self.values = [[NSMutableDictionary alloc] init]; [self loadFile:InAppSettingsRootFile]; [[NSUserDefaults standardUserDefaults] registerDefaults:self.values]; } return self; }
    LEAKED OBJECT: NSCFDictionary EVENT TYPE: CFRetain RESPONSIBLE CALLER: [InAppSettingsReaderRegisterDefaults setValues]
    NO CODE HIGHLIGHTED FOR THIS ONE AND I DIDN'T EVEN SEE THIS METHOD **
    LEAKED OBJECT: NSCFDictionary EVENT TYPE: CFRelease RESPONSIBLE CALLER: [InAppSettingsReaderRegisterDefaults dealloc]
    NO CODE HIGHLIGHTED FOR THIS ONE **
    LEAKED OBJECT: NSArrayM EVENT TYPE: Malloc RESPONSIBLE CALLER: [InAppSettingsReaderRegisterDefaults init]
  • (id)init{ self = [super init]; if (self != nil) { self.files = [[NSMutableArray alloc] init]; self.values = [[NSMutableDictionary alloc] init]; [self loadFile:InAppSettingsRootFile]; [[NSUserDefaults standardUserDefaults] registerDefaults:self.values]; } return self; }
    LEAKED OBJECT: NSArrayM EVENT TYPE: Retain RESPONSIBLE CALLER: [InAppSettingsReaderRegisterDefaults setValues]
    NO CODE HIGHLIGHTED FOR THIS ONE AND I DIDN'T EVEN SEE THIS METHOD **
    LEAKED OBJECT: NSArrayM EVENT TYPE: Release RESPONSIBLE CALLER: [InAppSettingsReaderRegisterDefaults dealloc]
    NO CODE HIGHLIGHTED FOR THIS ONE **

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions