Git Product home page Git Product logo

mleaksfinder's Introduction

中文介绍 | FAQ中文

MLeaksFinder

MLeaksFinder helps you find memory leaks in your iOS apps at develop time. It can automatically find leaks in UIView and UIViewController objects, present an alert with the leaked object in its View-ViewController stack when leaks happening. More over, it can try to find a retain cycle for the leaked object using FBRetainCycleDetector. Besides finding leaks in UIView and UIViewController objects, developers can extend it to find leaks in other kinds of objects.

Communication

QQ group: 482121244

Installation

pod 'MLeaksFinder'

MLeaksFinder comes into effect after pod install, there is no need to add any code nor to import any header file.

WARNING: FBRetainCycleDetector is removed from the podspec due to Facebook's BSD-plus-Patents license. If you want to use FBRetainCycleDetector to find retain cycle, add pod 'FBRetainCycleDetector' to your project's Podfile and turn the macro MEMORY_LEAKS_FINDER_RETAIN_CYCLE_ENABLED on in MLeaksFinder.h.

Usage

MLeaksFinder can automatically find leaks in UIView and UIViewController objects. When leaks happening, it will present an alert with the leaked object in its View-ViewController stack.

Memory Leak
(
    MyTableViewController,
    UITableView,
    UITableViewWrapperView,
    MyTableViewCell
)

For the above example, we are sure that objects of MyTableViewController, UITableView, UITableViewWrapperView are deallocated successfully, but not the objects of MyTableViewCell.

Mute Assertion

If your class is designed as singleton or for some reason objects of your class should not be dealloced, override - (BOOL)willDealloc in your class by returning NO.

- (BOOL)willDealloc {
    return NO;
}

Find Leaks in Other Objects

MLeaksFinder finds leaks in UIView and UIViewController objects by default. However, you can extend it to find leaks in the whole object graph rooted at a UIViewController object.

- (BOOL)willDealloc {
    if (![super willDealloc]) {
        return NO;
    }
    
    MLCheck(self.viewModel);
    return YES;
}

mleaksfinder's People

Contributors

iukey avatar yangyangyyluck avatar zepo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.