Increase number of inotify instances with:
echo 1000000000 > /proc/sys/fs/inotify/max_user_instances
Increase number of openable files with:
ulimit -n ...
Check hardlimit with:
ulimit -n -H
#include <sys/inotify.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
int main() { | |
int i, fd; | |
for (i = 0; i < 1000000; i++) { | |
fd = inotify_init(); | |
if (fd == -1) { | |
perror("inotify_init"); | |
break; | |
} | |
} | |
printf("Created %d inotify instances\n", i); | |
pause(); | |
return 0; | |
} |
#include <sys/socket.h> | |
#include <netinet/in.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <arpa/inet.h> | |
int main() { | |
int i, sockfd; | |
for (i = 0; i < 1000000; i++) { | |
sockfd = socket(AF_INET, SOCK_STREAM, 0); | |
if (sockfd == -1) { | |
perror("socket"); | |
break; | |
} | |
} | |
printf("Created %d sockets\n", i); | |
pause(); | |
return 0; | |
} |