On Thu, 6 Mar 2008, Edzer Pebesma wrote:
I suspect that readGDAL opens connections to the files, but does not
close them and the program fails because too many files have been
openened simultaneously. I do not get messages like "Closing GDAL
dataset handle 0x8ff7900... destroyed ... done." when I run the script.
Does anybody on the r-sig-geo list have similar experiences?
Looking at readGDAL, it seems that GDAL.close is called on the open file
handle before the data are returned. This should give you the handle ...
destroyed ... messages for each file you open.
In the C code of package rgdal, I see reference to GDALOpen(), but not
to GDALClose(). I guess it should?
Where? In general, handles to GDAL datasets are all that are open and
visible in R, they are external pointers, and are either destroyed by
design, calling the C++ function RGDAL_CloseHandle in
src/gdal-bindings.cpp, l. 357, or by the finalizer - see the beginning of
R/gdal.R, and uses of .setCollectorFun(), which accompany calls to
RGDAL_CloseHandle in class definitions.
I don't think that this is a problem in compiled code, because connections
only exist in R code, and are not used directly by readGDAL().
Roger