[Gdal-dev] memory leak in MapInfo layer
Richard Matsunaga
richard.matsunaga at waypointinfo.com
Wed Jun 14 06:29:13 EDT 2006
Sorry. That's a typo. The feature is added to the layer inside the using
block (wouldn't compile otherwise).
I don't dispose of the point object because it is owned by the feature once
SetGeometryDirectly is called.
AddFeature is using CreateFeature (the naming makes more sense to me, so I
took liberties :)
Richard
-----Original Message-----
From: Ari Jolma [mailto:ari.jolma at tkk.fi]
Sent: June 14, 2006 2:29 AM
To: Richard Matsunaga
Cc: 'Mateusz Loskot'; gdal-dev at lists.maptools.org
Subject: Re: [Gdal-dev] memory leak in MapInfo layer
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