Skip to content

Instantly share code, notes, and snippets.

@charles-dyfis-net
Created April 15, 2010 21:23
Show Gist options
  • Save charles-dyfis-net/367679 to your computer and use it in GitHub Desktop.
Save charles-dyfis-net/367679 to your computer and use it in GitHub Desktop.
function get_fd_count() {
local fds
cd /proc/$$/fd; fds=( * ) # avoid a StackOverflow source colorizer bug
echo "${#fds[@]}"
}
function fd_leak_func() {
while : ; do
echo ">> Current FDs: $(get_fd_count)"
read retval new_state < <(set +e; new_state=$(echo foo); retval=$?; printf "%d %s\n" $retval $new_state)
done
}
fd_leak_func
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment