开发者

Does anyone know why the SimpleFTPSample that apple provides leaks memory?

I noticed that the SimpleFTPSample that apple provides leaks memory. The Leaks Performan开发者_JAVA技巧ce tool detects a leak when using the "List" sample. A leak is detected after you press the "List" button the second time. Does anyone know why? ie have a fix? I am considering using FTP in my app, but don't want to create a leaky app. Thanks.


(oh old Question)
In the Statusbar under Build use "Build and Analyse" this points out a leak in line 85 of AppDelegate.m Potential leak of object allocated on line 85 and stored into initialDefaultsChanged
My solution is to release initialsDefaults after register it to Defaults on line 96

#if ! TARGET_IPHONE_SIMULATOR
    {
        NSMutableDictionary *   initialDefaultsChanged;

        initialDefaultsChanged = [initialDefaults mutableCopy];
        assert(initialDefaultsChanged != nil);

        [initialDefaultsChanged setObject:@"" forKey:@"CreateDirURLText"];
        [initialDefaultsChanged setObject:@"" forKey:@"PutURLText"];

        initialDefaults = initialDefaultsChanged;
    }
    #endif

    [[NSUserDefaults standardUserDefaults] registerDefaults:initialDefaults];
    [initialDefaults release];//add this
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜