OSX ping & Cannot allocate memory

[09:58:20] 2 $ ping 4.2.2.2
PING 4.2.2.2 (4.2.2.2): 56 data bytes
ping: sendto: Cannot allocate memory
ping: sendto: Cannot allocate memory
Request timeout for icmp_seq 0
ping: sendto: Cannot allocate memory
Request timeout for icmp_seq 1

I’ve been having a pain in the ass time troubleshooting a laptop’s sporadic issue with connecting when waking up after sleep. I narrowed it down to sleeping when on VPN and, previously, only a restart would help.

My routing table looked like this.

[10:10:23] $ netstat -nr
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 192.168.1.1 UGSc 28 4 en1
127 127.0.0.1 UCS 0 1 lo0
127.0.0.1 127.0.0.1 UH 5 1211656 lo0
169.254 link#5 UCS 0 0 en1
192.168.1 link#5 UCS 3 0 en1
192.168.1.1 0:25:9c:67:d1:5c UHLWIir 26 58 en1 1146
192.168.1.255 ff:ff:ff:ff:ff:ff UHLWbI 0 28 en1

I was able to solve this by removing all routes to my local network, then turning off wifi and reconnecting to my home network.

[10:10:40] $ sudo route delete 192.168.1.0

Hope this helps someone else!

One thought on “OSX ping & Cannot allocate memory”

Leave a Reply