Instruments: no leak shows up


#1

I had the same problem with no leaks showing up. I’m extremely annoyed by this chapter. Anyway I came on here looking for answers and saw your post. I Googled around a bit and this seems to have worked. Try this:

Go to Product up above.
Then click on Scheme. Then click on Edit Scheme.
Click on Profile BMITime on the left-hand side.
Switch the Build Configuration from Release to Debug and then give it a shot.

I also modified my main.m different from the books suggestion to make it more apparent when leaks started to appear. If you click on Console underneath the Cycles & Roots you can see your program running. If an employee doesn’t have an asset assigned to them then nothing will show up. But under the Graph column under Cycles & Roots a picture should now show up. Hope that helps.

main.m


        NSLog(@"Employees: %@", employeesArray);
        
        
        NSLog (@"Giving up ownership of one employee every 15 seconds");
        
        for (NSUInteger i = [employeesArray count]; i > 0; i--) {
        sleep (15);
        [employeesArray removeObjectAtIndex:0];
        }
        
       NSLog(@"Giving up ownership of employeesArray");
        employeesArray = nil;
      
        
//        // Remove 15 assets
//        for (int i = 0; i < 4; i++ ) {
//            // Get a random number between 0 and 9
//            NSUInteger randomIndex2 = random() % [employeesArray count];
//            
//            // Get a random employee from the array
//            BNREmployee *randomEmployee2 = [employeesArray objectAtIndex:randomIndex2];
//            
//            
//            // Remove the assets from the employee
//            [randomEmployee2 removeAsset];
//        }
    
        
        
    }
    return 0;
}