Macos 朱莉娅:限制使用readdlm时打开的文件数量
我有一些Julia代码,其中我使用readdlm函数打开了大量文件。我的代码如下所示:Macos 朱莉娅:限制使用readdlm时打开的文件数量,macos,io,julia,Macos,Io,Julia,我有一些Julia代码,其中我使用readdlm函数打开了大量文件。我的代码如下所示: for file in large_list_of_files open(file) do filehandle data = readdlm(filehandle) end #Do some data processing and store results end 当我运行此命令时,会出现以下错误: LoadError: SystemError: opening
for file in large_list_of_files
open(file) do filehandle
data = readdlm(filehandle)
end
#Do some data processing and store results
end
当我运行此命令时,会出现以下错误:
LoadError: SystemError: opening file <filename>: Too many open files
while loading In[28], in expression starting on line 28
in open at /Applications/Julia-0.4.0.app/Contents/Resources/juli/lib/julia/sys.dylib
in open at iostream.jl:102
in open at iostream.jl:112
in process_data at In[13]:11
[inlined code] from In[28]:31
in anonymous at no file:30
此外,我正在使用Julia 0.4.0内核的Jupyter运行这段代码,但我怀疑这会有什么不同
编辑:我在Github上注意到了这个问题,ViralBShah说这个问题已经解决了,但我认为不是
编辑:我尝试过使用gc()函数,但这也不能解决问题。似乎已经解决了:
测试
- MacOS HighSierra 10.13.6
- julia版本1.5.1
你看过这个吗?谢谢你的链接,是的,我之前确实看到了,这可能是一个不错的解决方案,但我觉得Julia应该在我告诉它时关闭文件。
Julia Version 0.4.0
Commit 0ff703b* (2015-10-08 06:20 UTC)
Platform Info:
System: Darwin (x86_64-apple-darwin13.4.0)
CPU: Intel(R) Core(TM) i7-3720QM CPU @ 2.60GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.3
using DelimitedFiles
# 329571 files:
for file in split(String(read(a)),"\n")[1:end-1]
open(file) do fh
try readdlm(fh)
catch ff
end
end
end