Skip to content
Catch leaking view controllers without opening Instruments.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Configs
DeallocationChecker.xcodeproj
DeallocationCheckerUITests Add Handler.alert Sep 22, 2018
ExampleApp
Resources Update README Sep 22, 2018
Sources s/DeallocationCheckerManager/DeallocationChecker/g Sep 22, 2018
.gitignore
.swift-version Change .swift-version to 4.2 Sep 22, 2018
.travis.yml
DeallocationChecker.podspec Bump version to 3.0 Sep 22, 2018
LICENSE
Package.swift Initial commit Jun 25, 2017
README.md

README.md

DeallocationChecker

Learn about leaking view controllers without opening Instruments.

Build Status

Usage

First, enable the library by calling (for example from your application delegate):

#if DEBUG
    DeallocationChecker.shared.setup(with: .alert) // There are other options than .alert too!
#endif

Then, in your view controllers from within viewDidDisappear(_:) override, call:

override func viewDidDisappear(_ animated: Bool) {
    super.viewDidDisappear(animated)

    DeallocationChecker.shared.checkDeallocation(of: self)
}

If a view controller isn’t deallocated after disappearing for good, you'll see a helpful alert:

Leaked view controller demo

At this point we can simply open the Memory Graph Debugger to investigate the reason of a cycle.

Installation

CocoaPods

Add the line pod "DeallocationChecker" to your Podfile

Carthage

Add the line github "fastred/DeallocationChecker" to your Cartfile

Author

Project created by Arek Holko (@arekholko on Twitter).

You can’t perform that action at this time.