Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/haifengkao/leakcanaryios
Memory leak detection in iOS unit test
https://github.com/haifengkao/leakcanaryios
Last synced: about 1 month ago
JSON representation
Memory leak detection in iOS unit test
- Host: GitHub
- URL: https://github.com/haifengkao/leakcanaryios
- Owner: haifengkao
- License: mit
- Created: 2015-11-20T19:12:18.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-06T08:00:33.000Z (almost 8 years ago)
- Last Synced: 2024-11-18T04:31:18.196Z (about 2 months ago)
- Language: Objective-C
- Homepage:
- Size: 281 KB
- Stars: 9
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LeakCanaryiOS
[![CI Status](http://img.shields.io/travis/haifengkao/LeakCanaryiOS.svg?style=flat)](https://travis-ci.org/haifengkao/LeakCanaryiOS)
[![Coverage Status](https://coveralls.io/repos/haifengkao/LeakCanaryiOS/badge.svg?branch=master&service=github)](https://coveralls.io/github/haifengkao/LeakCanaryiOS?branch=master)
[![Version](https://img.shields.io/cocoapods/v/LeakCanaryiOS.svg?style=flat)](http://cocoapods.org/pods/LeakCanaryiOS)
[![License](https://img.shields.io/cocoapods/l/LeakCanaryiOS.svg?style=flat)](http://cocoapods.org/pods/LeakCanaryiOS)
[![Platform](https://img.shields.io/cocoapods/p/LeakCanaryiOS.svg?style=flat)](http://cocoapods.org/pods/LeakCanaryiOS)Do you want to know if there is a memory leak in your XCTest?
This is the tool for you.Motivated by [Leak Canary](https://github.com/square/leakcanary) and [HeapInspector](https://github.com/tapwork/HeapInspector-for-iOS).
## Usage
Add the follow codes to your test case
```objc
- (void)setUp
{
[LeakCanary beginSnapShot:@[@"UIView"]];
}- (void)tearDown
{
NSSet* leakedObjects = [LeakCanary endSnapShot];
XCTAssertTrue(leakedObjects.count == 0, @"should not have leaked UIView and UIViewController objects");
}
```
If you use [Kiwi](https://github.com/kiwi-bdd/Kiwi)
```objc
#import
#importbeforeEach(^{
[LeakCanary beginSnapShot:@[@"UIView"]];
});
afterEach(^{
NSSet* leakedObjects = [LeakCanary endSnapShot];
[[@(leakedObjects.count) should] equal:@(0)];
});
```## Requirements
## Installation
LeakCanaryiOS is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:```ruby
pod "LeakCanaryiOS"
```## Author
Hai Feng Kao, [email protected]
## License
LeakCanaryiOS is available under the MIT license. See the LICENSE file for more info.