|
1 | 1 | # MLeaksFinder
|
2 |
| -MLeaksFinder helps you find memory leaks in your iOS apps at develop time. It can automatically find leaks in UIView and UIViewController objects, hit assertion and print the View-ViewController stack when leaks happening. You can also extend it to find leaks in other kinds of objects. |
| 2 | +MLeaksFinder helps you find memory leaks in your iOS apps at develop time. It can automatically find leaks in UIView and UIViewController objects, present 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. Besides finding leaks in UIView and UIViewController objects, developers can also extend it to find leaks in other kinds of objects. |
3 | 3 |
|
4 | 4 | # Communication
|
5 | 5 | QQ group: 482121244
|
6 | 6 |
|
7 | 7 | # Installation
|
8 |
| -- Download MLeaksFinder |
9 |
| -- Add MLeaksFinder as a subproject |
10 |
| -- Add MLeaksFinder to your Target Dependencies and Link Binary With Libraries |
11 |
| -- Click your app's target, then "Build Settings", search for "Other Linker Flags", add '-ObjC' |
12 |
| - |
13 |
| -Or you can simply copy the source files into your project. |
14 |
| - |
15 |
| -## Installation with CocoaPods |
16 | 8 | ```
|
17 | 9 | pod 'MLeaksFinder'
|
18 | 10 | ```
|
19 | 11 |
|
20 | 12 | # Usage
|
21 |
| -MLeaksFinder can automatically find leaks in UIView and UIViewController objects. When leaks happening, it will hit assertion and print the leaked object in its View-ViewController stack. |
| 13 | +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. |
22 | 14 | ```
|
23 |
| -*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Possibly Memory Leak. |
24 |
| -In case that MyTableViewCell should not be dealloced, override -willDealloc in MyTableViewCell by returning NO. |
25 |
| -View-ViewController stack: ( |
| 15 | +Memory Leak |
| 16 | +( |
26 | 17 | MyTableViewController,
|
27 | 18 | UITableView,
|
28 | 19 | UITableViewWrapperView,
|
29 | 20 | MyTableViewCell
|
30 |
| -)' |
| 21 | +) |
31 | 22 | ```
|
32 | 23 |
|
| 24 | +For the above example, we are sure that objects of `MyTableViewController`, `UITableView`, `UITableViewWrapperView` are deallocated successfully, but not the objects of `MyTableViewCell`. |
| 25 | + |
33 | 26 | ## Mute Assertion
|
34 |
| -If your class is designed as singleton or for some reason objects of your class should not be dealloced, override -willDealloc in your class by returning NO. |
| 27 | +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. |
35 | 28 | ```objc
|
36 | 29 | - (BOOL)willDealloc {
|
37 | 30 | return NO;
|
|
0 commit comments