I tracked it down under ubuntu with the following commands
pdiof julia
lsof -p #fromprevoiucommand
which lists not only the number of files open, but also the path to the 
files.  Very useful.

I tracked this down and was a bit surprised.  My code was essentially doing 
the following
julia> f() = collect(eachline(open("testfile","r")))
f (generic function with 1 method)
julia> for j=1:typemax(Int)
       println(j)
       f()
       end
...
1011
ERROR: opening file testfile: Too many open files
 in open at ./iostream.jl:117
 in open at ./iostream.jl:125
 in anonymous at no file:3

which doesn't explicitly close the file I open.  I guess I had assumed 
eachline would close the file after iteration was finished, though the 
documentation does not say that it will.  I had further thought that the 
garbage collector would close the file once the function was done 
executing, which apparently also doesn't happen. I must have gotten the 
impression from python that the file would be automatically closed 
(sometime) after the function was done, since roughly equivalent code in 
python does not crash.  Is the garbage collector supposed to close the file 
in this case? 


Reply via email to