title: Memory management issue google maps on UITableViewCell in SWIFT 4
body: <p>The way I have implemented is :</p>
  
  <p>I have a nib: UITableViewCell, and there is a google map implemented with two markers and a path between two markers.</p>
  
  <p>When I run the program with sample 8 cells on UItableView, it is crashing some times, by saying <strong>app exit due to a memory management issue</strong></p>
  
  <p>In nib file <strong>"BookingHistoryTableViewCell"</strong>: </p>
  
  <pre><code>import UIKit
  import Google
  import GoogleMaps
  import GoogleMapsCore
  import GooglePlaces
  import GoogleToolboxForMac
  
  class BookingHistoryTableViewCell: UITableViewCell {
  
      //MARK: Outlets
      @IBOutlet weak var bottomView: UIView!
      @IBOutlet weak var mapView: GMSMapView!
  
      override func awakeFromNib() {
          super.awakeFromNib()
          self.bottomView.layer.shadowColor = UIColor(displayP3Red: 0, green: 0, blue: 0, alpha: 1).cgColor
          self.bottomView.layer.shadowRadius = 3
          self.bottomView.layer.shadowOpacity = 1
          self.bottomView.layer.shadowOffset = CGSize(width: 0, height: 0)
      }
  
      //main gate : 6.795046, 79.900768
      func setupMap(){
          let lat = 6.797222
          let lon = 79.902028
          let camera = GMSCameraPosition.camera(withLatitude: lat, longitude: lon, zoom: 17.0)
          let googleMapView = GMSMapView.map(withFrame: self.mapView.bounds, camera: camera)
  //        googleMapView.isMyLocationEnabled = true
  //        googleMapView.settings.tiltGestures = false
  //        googleMapView.settings.zoomGestures = false
  //        googleMapView.settings.scrollGestures = false
  //        googleMapView.accessibilityScroll(UIAccessibilityScrollDirection.left)
  //        googleMapView.mapStyle(withFilename: "googleMapsStyle02", andType: "json")
          self.mapView.addSubview(googleMapView)
          //(googleMapView, at: 0)
  
          let marker = GMSMarker()
          marker.position = CLLocationCoordinate2DMake(lat, lon)
          marker.title = "Main Title"
          marker.snippet = "Deescription"
          marker.map = googleMapView
      }
  
      override func layoutSubviews() {
          super.layoutSubviews()
          //self.setupMap()
      }
  
      override func layoutIfNeeded() {
          super.layoutIfNeeded()
          self.setupMap()
      }
  
      override func setNeedsLayout() {
          super.setNeedsLayout()
  //        self.setupMap()
      }
  
  
  
      override func setSelected(_ selected: Bool, animated: Bool) {
          super.setSelected(selected, animated: animated)
      }
  
  }
  </code></pre>
  
  <p>Then on tableViews at <strong>MyBookingsViewController</strong> :</p>
  
  <pre><code>viewDidLoad(){
    self.tableView.register(UINib(nibName: "BookingHistoryTableViewCell" , bundle: nil), forCellReuseIdentifier: "BookingHistoryTableViewCell")
          self.tableView.rowHeight = UITableViewAutomaticDimension
          self.tableView.estimatedRowHeight = 30
  }
  </code></pre>
  
  <p>then as an extension I have table controls :</p>
  
  <pre><code>extension MyBookingsViewController: UITableViewDelegate, UITableViewDataSource{
      func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
          return 8
      }
  
      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
          let cell = tableView.dequeueReusableCell(withIdentifier: "BookingHistoryTableViewCell", for: indexPath) as! BookingHistoryTableViewCell
          cell.selectionStyle = .none
          return cell
      }
  
  
      func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
          print("selected row number : \(indexPath.row)")
      }
  
      func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -&gt; UISwipeActionsConfiguration? {
          let editAction = UIContextualAction(style: .normal, title: "Edit") { (action, view, handler) in
              print("tapped on Edit : \(indexPath.row)")
          }
  
          let deleteAction = UIContextualAction(style: .destructive, title: "Delete") { (action, view, handler) in
              print("tapped on Delete : \(indexPath.row)")
          }
  
          editAction.backgroundColor = UIColor(displayP3Red: 183/255, green: 183/255, blue: 183/255, alpha: 0.9)
          editAction.image = #imageLiteral(resourceName: "icon_edit_white")
          deleteAction.backgroundColor = UIColor(displayP3Red: 251/255, green: 86/255, blue: 92/255, alpha: 0.9)
          deleteAction.image = #imageLiteral(resourceName: "icon_delete_white")
          let configuaration = UISwipeActionsConfiguration(actions: [deleteAction, editAction])
          configuaration.performsFirstActionWithFullSwipe = true
          return configuaration
      }
  
  }
  </code></pre>
  
  <p>This is kinda needed and in real life application there will be 100 of cells like this. is there any way to render only visible cells to the display area or some method to save the memory?</p>