You should look for the problem that is causing this trouble rather than hacking the Safari to stop showing you notifications. If it's upto to kill the process, preventing notifications will not stop it.
Here are few troubleshooting tips.
1) Check your disk space where your OS is installed. Free if needed (Swap memory reason)
2) Check your HDD & Battery health. You can get few freeware utilities.
3) Check temperature of your system. It often crash apps or even restarts the devices.
4) Clear the browser cache folder from base. See this Post for details.
5) Reset SMC
Press Shift + Control + Option + Power button at the same time.
Release all keys and the power button at the same time.
6) Reset NVRAM
Shut down your Mac.
Press the power button.
Before the grey screen appears, press the Command, Option, P, and R keys at the same time.
Hold the keys until your computer restarts and you hear the startup sound a second time. ...
Release the keys.
7) Check for Safari and iTunes Updates.
If none of the above works and your hardware has no issues, than probably it's time to fresh install (upgrade) your OS.