Skip to content

Instantly share code, notes, and snippets.

@hintjens
Created November 8, 2010 15:06
Show Gist options
  • Save hintjens/667779 to your computer and use it in GitHub Desktop.
Save hintjens/667779 to your computer and use it in GitHub Desktop.
Exhaust file handles
// Exhaust file handles per process
#include "zmq.h"
#include "stdio.h"
int main ()
{
void *context = zmq_init (1);
int socket_nbr;
for (socket_nbr = 0; socket_nbr < 8000000; socket_nbr++) {
void *socket = zmq_socket (context, ZMQ_REQ);
if (!socket)
break;
}
printf ("This system allows up to %d sockets\n", socket_nbr);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment