Skip to content

Instantly share code, notes, and snippets.

@uc-compass-bot
Created October 15, 2019 14:17
Show Gist options
  • Save uc-compass-bot/c740d42ea2565ec8527159cce3c8dbc1 to your computer and use it in GitHub Desktop.
Save uc-compass-bot/c740d42ea2565ec8527159cce3c8dbc1 to your computer and use it in GitHub Desktop.
Memory Checker
import Foundation
public class MemoryChecker {
public static func verifyDealloc(object: AnyObject?) {
#if DEBUG
DispatchQueue.main.asyncAfter(deadline: .now() + 5) { [weak object] in
if let object = object {
fatalError("Class Not Deallocated: \(String(describing: object.classForCoder ?? object)))")
}
}
#endif
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment