[Gdal-dev] memory leak in MapInfo layer

Ari Jolma ari.jolma at tkk.fi
Wed Jun 14 02:28:47 EDT 2006


Richard Matsunaga kirjoitti:
> 			using (OgrFeature feature = new
> OgrFeature(layer.LayerFeatureDefinition))
> 			{
> 				for (int fieldIndex = 0; fieldIndex <
> fieldValues.Count; fieldIndex++)
> 				{
> 					feature.SetField(fieldIndex,
> fieldValues[fieldIndex]);
> 				}
>
> 				OgrPoint point = new OgrPoint(point.X,
> point.Y);
>
> 				feature.SetGeometryDirectly(point);
>
> 	
> feature.SetStyleString(/*MapInfoStyleString*/);
> 			}
>
> 			layer.AddFeature(feature);
>   

Some comments:

- why are you using the feature outside the using block?
- what is "AddFeature"? OGR has CreateFeature and SetFeature
- why you do not dispose the point object?

Ari


-- 
Prof. Ari Jolma
Kartografia ja Geoinformatiikka / Cartography and Geoinformatics
Teknillinen Korkeakoulu / Helsinki University of Technology
POBox 1200, 02015 TKK, Finland
Email: ari.jolma at tkk.fi URL: http://www.tkk.fi/~jolma




More information about the Gdal-dev mailing list