[gdal-dev] How files are handled in OGR / GDAL

Frank Warmerdam warmerdam at pobox.com
Tue Mar 1 12:35:59 EST 2011


On 11-03-01 12:29 PM, Mikhail Tchernychev wrote:
> Hello List,
>
> I could probably figure it out from the source, but I would apprecaite
> if someone could point me in the right direction.
>
> The question is: does GDAL / OGR loads the file in the memory when it
> opens in or it just keeps reference to the actual file
>
> Say if I open it, process it etc
>
> hDS =OGROpen  <http://www.gdal.org/ogr/ogr__api_8h.html#123bb02ac8c5cfe143e132f627531125>("point.shp", FALSE, NULL );
>
> ....
>
> and then do (without closing)
>
>   poLayer->ResetReading  <http://www.gdal.org/ogr/classOGRLayer.html#ad0f2cd7f0587584b8f382c6a913583c>();
>
> and process again
>
> would it actually trigger re-reading file from the disk or not?
>
> In other words does OGR creates complete memory image for the file or
> just reads actual file when it needs something?

Mikhail,

These is driver dependent.  But we try to avoid holding too much of the
underlying file in memory.  In the case of the shapefile driver the .shx
index contents are loaded into RAM and kept there but the .shp and .dbf
records are read as-needed.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list