When we perform a fork in Unix, open file handles are inherited, and if we don\'t need to use them we should close them. However, when we use libraries, file handles may be open
In Linux you can check /proc//fd directory - for every open fd there will be a file, named as handle. I'm almost sure this way is non-portable.
/proc//fd
Alternatively you can use lsof - available for Linux, AIX, FreeBSD and NetBSD, according to man lsof.
lsof
man lsof