Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jasonbekolay/dad7c446ae1b02f174dc3eb3a5ea70ee to your computer and use it in GitHub Desktop.
Save jasonbekolay/dad7c446ae1b02f174dc3eb3a5ea70ee to your computer and use it in GitHub Desktop.
Killing a WKWebView content process in the iOS simulator to trigger a webViewWebContentProcessDidTerminate call
# In the command line, find the PID of your simulator process:
ps -p `pgrep launchd_sim`
# or if you have many simulators running:
ps -A | grep launchd_sim
# Find the PID of the WebContent process:
pgrep -P <simulator-pid> 'com.apple.WebKit.WebContent'
# kill it
kill <webcontent-pid>
# or if you want a one-lner:
kill $(pgrep -P $(pgrep launchd_sim) 'com.apple.WebKit.WebContent')
@jasonbekolay
Copy link
Author

jasonbekolay commented Jun 20, 2023

Hello sir
Is there a way to kill WebContent process of a real iOS device ?

I have not looked into this, but my guess is there isn't a simple way to do it. If it is possible, my best guess is using Instruments. If not, then maybe you can include some sort of memory leak or infinite allocation in your web code.

@FlashTang
Copy link

Hello sir
Is there a way to kill WebContent process of a real iOS device ?

I have not looked into this, but my guess is there isn't a simple way to do it. If it is possible, my best guess is using Instruments. If not, then maybe you can include some sort of memory leak or infinite allocation in your web code.

Thank you sir , memory leak or infinite allocation sounds a good idea .

@pbush25
Copy link

pbush25 commented Aug 19, 2023

You have no idea how many attempts I've had at trying to fix this for react pages built into our app and I was able to immediately reproduce and solve with this. THANK YOU!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment