Iphone SDK Utility Application template has leak

前端 未结 8 1034
一向
一向 2020-12-06 11:05

i\'m only create an project with a Utility Application template. This template has a native memory leak when i push \"info button\" to flip the view.

Anyone know how

相关标签:
8条回答
  • 2020-12-06 11:32

    This must be a bug. It appears in Apple's own example, PageControl, found here: http://developer.apple.com/iphone/library/samplecode/PageControl/index.html#//apple_ref/doc/uid/DTS40007795

    0 讨论(0)
  • 2020-12-06 11:38

    Got the leak doing this:

    XCode 3.2--

    File, New Project, Navigation-based Application
    Give it a name
    Build It
    Run With Performance Tools -> Leaks

    When Instruments comes up, click on Leaks (you might have to click the little icon at the bottom that looks like four boxes within a box)

    About 7 seconds after running you should see the leak: -- Malloc 128 Bytes, some Address, 128 Bytes, CoreGraphics, open_handle_to_dylib_path

    I traced it to this code in the AppDelegate:

    //APPLE CODE
    - (void)applicationDidFinishLaunching:(UIApplication *)application {    
    
        // Override point for customization after app launch    
    
        [window addSubview:[navigationController view]];
        [window makeKeyAndVisible];
    }
    

    I broke out the navigationController (did a separate alloc and release) and COMMENTED OUT the addSubview: action - there was no leak - and, obviously, the screen was blank.

    It wasn't until I attempted addSubview that the leak occurred. Since there are numerous ways to add a subview, I tried those. Each resulted in the leak or a blank screen.

    0 讨论(0)
提交回复
热议问题