I have a viewcontroller (lets called it TableViewController). When user taps a button inside custom UITableViewCell, a new view controller (lets called it DetailViewcontroller) is opening. When user tap back button inside DetailViewController, I called dismiss function and TableViewController opens again. 

My problem is that when I do this scenario like 50 times, memory usage gets higher. So I guess It doesn't do any deallocation.

[![Memory Usage](https://i.stack.imgur.com/7XxKU.png)](https://i.stack.imgur.com/7XxKU.png)

How I opens DetailViewController;

```
    @objc func voteBtnTapped(_ sender: UIButton){
    guard let team = FirebaseManager.instance.currentTeam else { return }
    FirebaseManager.instance.delegate = nil
    let voteController = VoteViewController()
    voteController.currentTeam = team
    let transition = CATransition()
    transition.duration = 0.5
    transition.type = kCATransitionPush
    transition.subtype = kCATransitionFromRight
    transition.timingFunction = CAMediaTimingFunction(name:kCAMediaTimingFunctionEaseInEaseOut)
    view.window!.layer.add(transition, forKey: kCATransition)
    self.present(voteController, animated: false, completion: nil)
}

```

How I dismiss DetailViewController;

```
    @objc func backBtnTapped(_ sender: UIButton){
    FirebaseManager.instance.delegate = nil
    let transition = CATransition()
    transition.duration = 0.5
    transition.type = kCATransitionPush
    transition.subtype = kCATransitionFromLeft
    transition.timingFunction = CAMediaTimingFunction(name:kCAMediaTimingFunctionEaseInEaseOut)
    view.window!.layer.add(transition, forKey: kCATransition)
    self.dismiss(animated: false, completion: nil)
}

```

It says leaks in Instruments but I can't figure out, what cause these leeks.

[![enter image description here](https://i.stack.imgur.com/ZeK8w.jpg)](https://i.stack.imgur.com/ZeK8w.jpg)

EDIT: I found that the picker library I'm using (in DetailViewController), blocks deallocation. Do you have any idea why It blocks it and how can I handle it?

From respond to answer how I declare pickerView:

```
 let config = AZAPickerConfiguration<PickerItem>(items: (1...10).map { PickerItem(number: $0) },
                                                    defaultSelectedIndex: 4,
                                                    selectedFont: UIFont(name: "SourceSansPro-SemiBold", size: 50)!, nonSelectedFont:UIFont(name: "SourceSansPro-Light", size: 20)!, selectionRadiusInPercent: 0.5,
                                                    selectionBackgroundColor: UIColor(red:0.00, green:0.42, blue:0.20, alpha:1.0), itemWidth: 80)

    self.pickerView = AZAPicker<PickerItem>(with: config, frame: .zero)

    pickerView!.backgroundColor = .white
    pickerView!.translatesAutoresizingMaskIntoConstraints = false
    //self.pickerView!.onPickItem = self.picker
    self.pickerView!.onPickItem = {( sender : AZAPicker<PickerItem>,item:PickerItem) in
        print("didPickItem: \(item)")
        self.currentPoint = item.number

    }

```

<https://github.com/AvanzaBank/AZAPicker>