memLeaksExample README

Created by: Owen Goss, Streaming Colour Studios
http://www.streamingcolour.com

Originally demonstrated as part of a presentation on fixing memory leaks in iOS apps for FITC Mobile, 2010.

This code and Xcode project are distributed under the MIT License:
=======================
Copyright (c) 2010 Streaming Colour Studios

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
=======================

You should have a folder called memLeaksExample after unzipping. Inside you will find an Xcode project for the leaky code.

Open the project in Xcode. The code is set up to leak in several places. Comments marked with:

// FIX:

Show how to fix the given leaks.

In order to build for your device, you must:
1) Open the project in Xcode
2) Select the 'memLeakExample' Target in the Groups & Files pane
3) Get Info (or double-click) on the build target
4) Select the "Properties" tab
5) Set your Identifier to match your development profile
6) Select the "Build" tab
7) Find the "Code Signing Identity" items for each configuration
8) Set the signing identity to your development profile

Build and run the code on your device to copy it to your device.

Stop Debugging and kill the app from running in the background (if you're running on iOS 4.x).

Launch Instruments and open a Leaks tool. Once the Leaks tool has opened in a window:
1) Choose your iPhone/iPad/iPod touch from the "Choose Target" picker
2) Choose the "memLeakExample" app from the "Choose Target" item within the "Choose Target" picker.
3) Click "Record" to start recording the app
4) Navigate into the 2nd screen
5) Click the "leak me" button a couple of times
6) Click the Back button in the nav bar to return to the Root view controller
7) Check for leaks.
8) Fix whatever leaks are reported and repeat until no new leaks are found.