getting "out of memory" error when trying to load specific websites (am not out of RAM) UPDATE: Rich's solution (with the checkmark) solved my problem! I also posted an answer with a workaround that may help if Rich's solution doesn't work for you. The answer that received the bounty was the best at the time, but it doesn't have an actual solution (though it helped with troubleshooting).  



I'm having a problem where my computer (Macbook Pro, 8GB RAM, OS 10.8) will not to attempt to load certain websites. Nothing fixes it except for rebooting. This occurs when nothing else is obviously wrong with my computer or internet connection, and when other sites load without problems. 

When this occurs, here are the errors I get:


Chrome: Error 13 (net::ERR_OUT_OF_MEMORY)
Safari: "The error is: 'The operation couldn't be completed. Cannot allocate memory.'  (NSPOSIXErrorDomain:12)"
Firefox: No response after entering the URL and pressing return (no error message, no throbber to indicate that it's loading or trying to contact the site). 
ping:

PING google.com (74.125.224.135): 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



(after which I canceled out)

The first time I noticed this, it occurred for one or two sites I tried to visit. I was still able to use facebook and google. Later in the day, the error extended to facebook and google as well. After rebooting, those sites became accessible again, but later on I became unable to access other sites (stackexchange.com, surveygizmo.com). 

Some other notes:


I can confirm that this happens on multiple wireless networks and VPNs. 
At the moment this was happening I had 2 GB of RAM "inactive" and 500 MB "free" out of 8 GB total, so I'm not actually out of memory. Other websites and applications are responding snappily and there's no sign of excessive swapping.
The response from ping seems to suggest that the problem doesn't affect DNS (though the IP address could have been cached somewhere).  


I've only found one other reference to this problem, in this Apple support thread. No solution was found except for rebooting. 

NOTE: This is not a problem with running out of RAM

Activity Monitor shows plenty of free / inactive memory. There's not an excessive amount of paging going on. Other websites load without problems. There may be some other kind of memory allocation error going on, but I can't imagine any way that a plain old RAM shortage would disable certain specific websites, with no other impact on performance.
I wasn't able to get my network back by disabling and re-enabling TCP/IP or the Wi-Fi. It seems in my case the computer had gone to sleep with a Juniper VPN connection and when it woke back up the connection had timed out and the routes weren't cleaned up. For me, I had two computers, one working and one not, and so was able to identify the problem after running netstat -rn.

On the computer that wasn't working, I had a destination of 192.168.43.1 with a gateway of link#5. On the computer that WAS working, the gateway for that destination was the mac address of the wireless router, so I removed that route with:

sudo route delete -host 192.168.43.1


After this, I could ping my wireless router and also get back to the internet.

Some people claimed that going to Settings → Network → Wi-Fi → Advanced → Proxies and turning on Auto Proxy Discovery worked for them. I was not able to verify this as my connection was fixed by deleting the 'dead' route.