/LeakChecker

Simple memory leak checker based on weak reference examination

Primary LanguageSwiftMIT LicenseMIT

icon

LeakChecker

Simple memory leak checker based on weak reference examination.

screen record

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

LeakChecker is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'LeakChecker'

Usage

  1. Activate LeakChecker.isEnabled = true (eg from AppDelegate.init)
  2. Use built-in handler DefaultLeakDetectedHandler.isEnabled = true or handle notification NSNotification.Name.LeakChecker.leakDetected by yourself
  3. Add calls checkLeak(of:) for all objects may be accidentially retained before their expected deallocation
class YourViewController: UIViewController {

    private var viewModel = ViewModel()

    deinit {
        checkLeak(of: viewModel)
    }

Author

Max Sol, maxoldev@gmail.com

License

LeakChecker is available under the MIT license. See the LICENSE file for more info.

Leak icons created by Smashicons - Flaticon