Latest 3.0
Homepage https://github.com/fastred/DeallocationChecker
License MIT
Platforms ios 8.0, tvos 9.0
Frameworks Foundation, UIKit
Authors

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).

Latest podspec

{
    "name": "DeallocationChecker",
    "version": "3.0",
    "summary": "Learn about leaking view controllers without opening Instruments.",
    "description": "DeallocationChecker asserts that a view controller gets deallocated afternits view is removed from the view hierarchy.",
    "homepage": "https://github.com/fastred/DeallocationChecker",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Arkadiusz Holko": "[email protected]"
    },
    "social_media_url": "https://twitter.com/arekholko",
    "platforms": {
        "ios": "8.0",
        "tvos": "9.0"
    },
    "source": {
        "git": "https://github.com/fastred/DeallocationChecker.git",
        "tag": "3.0"
    },
    "source_files": "Sources/**/*",
    "frameworks": [
        "Foundation",
        "UIKit"
    ]
}

Pin It on Pinterest

Share This