[Gdal-dev] memory leak in MapInfo layer

Mateusz Loskot mateusz at loskot.net
Tue Jun 13 15:56:11 EDT 2006


Richard Matsunaga wrote:
> I believe I am experiencing a memory leak in MapInfo tab layers using
>  the C API (called by C# code).


Is this your own C# binding?
Could you provide a piece of code?


> I am writing points to a MapInfo tab file. If I don't add the point 
> object to the OgrFeature, there is no leak. As soon as I add the 
> point (or any geometry), the memory leak occurs.


How are you adding the geometry to feature?
There is a different semanting between SetGeometry and
SetGeometryDirectly regarding ownership of passed geometry.
BTW, how are you detecting memory leaks?

> If I choose a Shapefile datasource, there is no leak.


Hmm, so I'd suspect MapInfo driver is leaking but I'd need to know more
details about how are you using it.


> Could there be something I am doing wrong that is leading to this 
> problem with MapInfo files?


Sure there could be a problem with using OGR incorrectly what can lead
to memory leaks.

> Another test that I did to confirm was to use 'OGR_F_SetGeometry' 
> instead of 'OGR_F_SetGeometryDirectly' (and destroy the original 
> geometry myself) and the same leak occurs.

Good test. So, something other place is leaking.
Please, provide us with more details about:
- C# bindings you are using
- piece of code you are creating/destroying geometries

Cheers
-- 
Mateusz Loskot
http://mateusz.loskot.net



More information about the Gdal-dev mailing list