[R-sig-Geo] [R-spatial-devel] readGDAL does not close connections
Roger Bivand
Roger.Bivand at nhh.no
Thu Mar 6 16:00:08 CET 2008
On Thu, 6 Mar 2008, Edzer Pebesma wrote:
> Paul Hiemstra 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
> --
> Edzer
>
> _______________________________________________
> R-spatial-devel mailing list
> R-spatial-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/r-spatial-devel
>
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo
mailing list