I am carrying out a ab test

 ab -n 10000 -c 10 http://www.mysite.com/

this is actually the output

Benchmarking www.mysite.com (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
socket: Cannot allocate memory (12)

I have attempted it several occasions it sometimes breaks even earlier. I've a lot of free memory this really is from top while im running ab

Mem:    524288k total,   269968k used,   254320k free,        0k buffers

Can someone explain?

Are you currently running ab on VPS? I believe that's restricted the max socket resource by Web service provider.