Various random website cannot be reached (cannot allocate memory) With process of elimination and testing the problems on 2 different Macs, 4 different networks, and many different browsers, I have isolated the cause of my network issue to be the actual Mac.

Certain sites, even though they are up, are completely unreachable by one of my Mac. Visiting on Chrome says:

Error code: ERR_OUT_OF_MEMORY


Safari says:

The operation couldn't be completed. Cannot allocate memory


ping says:

ping: sendto: Cannot allocate memory


I have no idea what to do next. I check my Network setting and no proxies are on. Is there any way to reset my network settings? Or any commands to provide more information to allow more diagnostic? 

Thanks.
What fixes it for me for wireless connection is this:


Go to network preferences
Open the connection data
Open "Advanced..." properties
Go to "TCP/IP" tab
Set "Configure IPv4" to off (remember the previous setting)
Click "OK" and then Apply
Wait for the connection to be reset
Go back to TCP/IP and re-enable IPv4 to the previous setting
Click "OK" and then "Apply" again


After the connection restores, the memory errors are gone. Still no idea why it happens or why this fixes it, but seems to work for me and is much faster than rebooting.