[R-sig-Geo] [R-spatial-devel] readGDAL does not close connections

Edzer Pebesma edzer.pebesma at uni-muenster.de
Thu Mar 6 16:22:26 CET 2008


Sorry, I need to polish my C++ a bit. The line in gdal-bindings.cpp is:
    pDataset->~GDALDataset();

gdal docs at 
http://gdal.org/classGDALDataset.html#4d110533d799bac7dcfad3c41d30c0e7
--
Edzer




Roger Bivand wrote:
> 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
>>
>>     
>
>




More information about the R-sig-Geo mailing list