An open API service indexing awesome lists of open source software.

https://github.com/antranapp/leakdetector

A SPM to support finding memory leaks for Swift projects.
https://github.com/antranapp/leakdetector

combine-framework ios leak-detection macos memory memory-leak memory-management swift

Last synced: 6 months ago
JSON representation

A SPM to support finding memory leaks for Swift projects.

Awesome Lists containing this project

README

          

# LeakDetector

## Introduction

`LeakDetector` is based on the implementation from [leakdetector](https://github.com/duyquang91/leakdetector) packge, which in turn is derived from the implementation of a leak detecktor in [UBER's RIB](https://github.com/uber/RIBs/tree/master/ios/RIBs/Classes/LeakDetector) framework.

In parallel to a RxSwift-based implementation, `LeakDetectorCombine` uses `Combine` framework to provide Combine-compatible APIs.

I accidently found another implementation of this `LeakDetector` from [LifeCycleKit](https://github.com/ashare80/LifecycleKit) which shares many similar ideas. The implementation in `LifeCycleKit` has much nicer APIs though. So I recommend you to take a look at the implementation of the `LeakDetector` in `LifeCycleKit` as well.

## Demo

There is a demo project to demostrate different use cases of the library.

![demo](./Docs/demo.gif)

This demo app focuses on common mistakes that could lead to retain cycles/memory leaks.

## References:

- RIBs: [https://github.com/uber/RIBs/tree/master/ios/RIBs](https://github.com/uber/RIBs/tree/master/ios/RIBs)
- LifeCycleKit: [https://github.com/ashare80/LifecycleKit](https://github.com/ashare80/LifecycleKit)
- You don’t (always) need [weak self]: [https://medium.com/flawless-app-stories/you-dont-always-need-weak-self-a778bec505ef](https://medium.com/flawless-app-stories/you-dont-always-need-weak-self-a778bec505ef)
- Everything you need to know about Memory Leaks in iOS: [https://medium.com/flawless-app-stories/all-about-memory-leaks-in-ios-cdd450d0cc34](https://medium.com/flawless-app-stories/all-about-memory-leaks-in-ios-cdd450d0cc34)
- swift-leak-check: [https://github.com/grab/swift-leak-check](https://github.com/grab/swift-leak-check)
- LifetimeTracker: [https://github.com/krzysztofzablocki/LifetimeTracker](https://github.com/krzysztofzablocki/LifetimeTracker)
- The Nested Closure Trap: [https://medium.com/flawless-app-stories/the-nested-closure-trap-356a0145b6d](https://medium.com/flawless-app-stories/the-nested-closure-trap-356a0145b6d)
- When to weakify: [https://jayeshkawli.ghost.io/when-to-weakify/](https://jayeshkawli.ghost.io/when-to-weakify/)