On Linux (and possibly other Unix-based systems) it’s possible to try and fire up an Eclipse-based product and see an error like the following in your console or log:
Error: “An internal error occurred during: “MyEclipse Memory Monitor”.
/home/user/Genuitec/Common/binary/com.sun.java.jre.linux.x86_64_1.6.0.006/lib/amd64/libmanagement.so: /home/user/Genuitec/Common/binary/com.sun.java.jre.linux.x86_64_1.6.0.006/lib/amd64/libmanagement.so: cannot open shared object file: Too many open files”
The reason behind this is that on Unix based systems the kernel AND the shell (e.g. “console”) can both be set with individual limits on how many file descriptors can be open.
Naturally the kernel-level limit will be enforced system-wide, and this limit is handled by the fs.file-max argument in the /etc/sysctl.conf file.
TIP: You can check the current setting by using the command cat /proc/sys/fs/file-max
It is recommended that you set the kernel file descriptor limit to 200k, you can do that by editing the /etc/sysctl.conf file and adding the following line to it:
Now that you have done this, it’s still possible that the individual shell file descriptor limit is small enough that when MyEclipse (or Eclipse) starts up, they are still opening too many file descriptors as limited by the shell.
To increase that value, you will want to edit the /etc/security/limits.conf file and increasing the file handle limits with the following lines:
* hard nofile 65535
* soft nofile 65535
TIP: You can check the current setting by using the command ulimit -n
Upping the shell limits to 65k seems to be enough in most cases. When both these tips are used together, you must restart your computer to ensure the changes have taken effect.
With both of these changes in place, your days of “Too many files open” with MyEclipse on Linux should be long gone!