[SOLVED] How to query the amount of free file handles from the OS? lazarus / 32-Linux ---------------------------------------------------------------------- Hartmut · 2023-06-17 09:16 I have the suspicion that my program does not close all files, which it opened, because after 18 days it stops doing it's job without cognizable reason. My program uses a foreign library which might be the causer. I assume that Linux (in my case Ubuntu Server) can not open an endless amount of file handles at the same time. Question1: is it possible to query, how many free file handles are currently left in Linux? Question2: is it possible to query, how many file handles a certain program is currently occupying? Thanks in advance. ---------------------------------------------------------------------- zeljko · 2023-06-17 11:09 Goto /proc/YOURAPPPID and see how many files are open, or use lsof with pid param to see all relevant informations. ---------------------------------------------------------------------- Hartmut · 2023-06-17 14:29 Thanks zeljko for your answer. I found out: With "ls -l /proc//fd" you can get a list of all opened file- handles of a PID. With "lsof -p " you also can get a list of all opened file- handles of a PID. ---------------------------------------------------------------------- zeljko · 2023-06-17 14:39 Also with ulimit you can increase number of opened file descriptors per process if needed ---------------------------------------------------------------------- Hartmut · 2023-06-17 15:17 Thanks.