[Gdal-dev] C# Dataset not calling GDALClose()?
Tamas Szekeres
szekerest at gmail.com
Wed Jul 11 10:19:57 EDT 2007
Richard,
Currently there's no build in mechanism in the GDAL C API to unload
the gdal dll. (By calling FreeLibrary on Windows for example).
Therefore you have to consider that the dll is loaded and locked until
the host application terminates in any case.
Best regards,
Tamas
2007/7/11, Richard Matsunaga <richard.matsunaga at waypointinfo.com>:
>
> Thanks Tamas, I didn't look deep enough to see what was happening in the C++
> code for Dataset.
>
> My problem is that our application is an ASP.NET web site and as soon as a
> class instantiates a GDAL or OGR object, the GDAL dll gets locked and is
> only released after some long period of idle time or if iisreset is called.
> This makes updating GDAL (or just republishing the entire website) a bit of
> a pain. I was initially worried that there may be a memory leak in there as
> well, but that seems to not be the case.
>
> The problem is easily reproduced using NUnit as well. Any test case that
> uses a GDAL resource will lock the GDAL dll as well.
>
> I just tried calling Ogr.RegisterAll() and it is the cause of the lock on
> the dll. There seems to be no way of releasing resources initialized by
> RegisterAll(). Not surprisingly, this behaviour is also flagged as a memory
> leak (albeit a small one) by DevPartner when using OGR in an application.
>
> Cheers,
> Richard
>
> > -----Original Message-----
> > From: gdal-dev-bounces at lists.maptools.org
> > [mailto:gdal-dev-bounces at lists.maptools.org] On Behalf Of
> > Tamas Szekeres
> > Sent: July 11, 2007 6:42 AM
> > To: Richard Matsunaga
> > Cc: gdal-dev at lists.maptools.org
> > Subject: Re: [Gdal-dev] C# Dataset not calling GDALClose()?
> >
> > Richard,
> >
> > OGR_DS_Destroy doesn't handle if the datasource is shared so
> > I consider OGRReleaseDataSource is the proper method to use.
> >
> > Could you describe your issue in more detail?
> >
> > Best regards,
> >
> > Tamas
> >
> >
> > 2007/7/11, Richard Matsunaga <richard.matsunaga at waypointinfo.com>:
> > >
> > >
> > > On a related note, I see that the Dispose() method for DataSource
> > > ultimately calls the OGRReleaseDataSource() method.
> > Shouldn't this be
> > > calling
> > > OGR_DS_Destroy() instead? The latter method is the one I
> > used in the
> > > hand-rolled C# wrapper class.
> > >
> > > Richard
> > >
> > >
> > > ________________________________
> > > From: gdal-dev-bounces at lists.maptools.org
> > > [mailto:gdal-dev-bounces at lists.maptools.org] On Behalf Of Richard
> > > Matsunaga
> > > Sent: July 10, 2007 11:59 PM
> > > To: gdal-dev at lists.maptools.org
> > > Subject: [Gdal-dev] C# Dataset not calling GDALClose()?
> > >
> > >
> > >
> > > Tamas,
> > >
> > > Shouldn't Dataset.Dispose() be calling GDALClose()? I'm trying to
> > > track down a resource issue and wondering if this is a
> > potential problem?
> > >
> > > Thanks,
> > > Richard
> > > _______________________________________________
> > > Gdal-dev mailing list
> > > Gdal-dev at lists.maptools.org
> > > http://lists.maptools.org/mailman/listinfo/gdal-dev
> > >
> > _______________________________________________
> > Gdal-dev mailing list
> > Gdal-dev at lists.maptools.org
> > http://lists.maptools.org/mailman/listinfo/gdal-dev
>
>
More information about the Gdal-dev
mailing list