[R] error in file(file, "r"): all connections are in use

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue May 4 23:06:54 CEST 2004


On Tue, 4 May 2004, Lei Jiang wrote:

> I am trying to read multiple files into R, but I got following message
> 
> Error in file(file, "r"): All connections are in use.
> 
> I clean up memory everytime I read in one file. Do i have to somehow
> release file connection everytime i read in one??

No, but you do need to release them eventually -- call close().
Your OS will also have a limit on the number of files you can have open at 
any one time, and it may not be much greater than the number of 
connections that can be in use (around 50).

I cannot imagine needing more than 50 connections open at once, but if you 
do you can alter the limit and recompile R.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list