title: WKWebView causes memory warning and the app is terminated
body: <p>I have a simple app with a WKWebView. When running on iOS 9, the memory usage stays around 5 Mb with is expected since WKWebView runs in a separate process. But memory usage for "other processes" goes high after a couple of navigations, especially on heavy pages. When the memory usage reaches its threshold, the app gets two memory warnings and then gets terminated. <code>webViewWebContentProcessDidTerminate</code> is never called.</p>
  
  <p>I've tried to respond to <code>didReciveMemoryWarning</code>in a couple of ways with no success. This is what I have tried:</p>
  
  <pre class="lang-swift prettyprint-override"><code>override func didReceiveMemoryWarning() {
     super.didReceiveMemoryWarning()
     print("**** MEMORY WARNING! ****")
     URLCache.shared.removeAllCachedResponses()
     URLCache.shared.diskCapacity = 0
     URLCache.shared.memoryCapacity = 0
  }
  </code></pre>
  
  <pre class="lang-swift prettyprint-override"><code>override func didReceiveMemoryWarning() {
     super.didReceiveMemoryWarning()
     print("**** MEMORY WARNING! ****")
     DispatchQueue.main.async {
              WKWebsiteDataStore.default().fetchDataRecords(ofTypes: WKWebsiteDataStore.allWebsiteDataTypes()) { records in
                  records.forEach { record in
                      WKWebsiteDataStore.default().removeData(ofTypes: record.dataTypes, for: [record], completionHandler: {})
                      print("[WebCacheCleaner] Record \(record) deleted")
                  }
              }
          }
  }
  </code></pre>
  
  <p>This is my code:</p>
  
  <pre class="lang-swift prettyprint-override"><code>import UIKit
  import WebKit
  
  class MyAwsomeWebViewController: UIViewController, WKNavigationDelegate {
  
      var page:WKWebView! = WKWebView()
  
      @IBOutlet weak var WKBaseView: UIView!
  
      override func viewDidLoad() {
          super.viewDidLoad()
          page.navigationDelegate = self
          if let url = URL(string: "https://hitta.se") {
              let request = URLRequest(url: url)
              page.load(request)
          }
  
      }
  
      override func loadView() {
          self.view = page
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          print("**** MEMORY WARNING! ****")
      }
  
      func webViewWebContentProcessDidTerminate(_ webView: WKWebView) {
          print("*** Terminate WebView Process ***")
      }
  
  
  }
  </code></pre>
  
  <p>How can I clear my WKWebViews memory usage when I receive a memory warning so that the app won't crash?</p>