This project is read-only.

Multipoing memory increase problem

Feb 27, 2013 at 2:49 PM
I add multipoint to maplayer and remove this multipoint feature from the map layer. Memory usage always increases after adding multipoint, also removing the multipoint does not decrease the memory usage . Sample code is as below. What can be the reason for memory increment?
  Map map = new Map();
    MapPointLayer pointLayer;
    IFeature feature;
    void addPointLayer(Color pointColor, int pointSize, Color fillColor)
    {

        FeatureSet fsPoint = new FeatureSet(FeatureType.Point);
        fsPoint.Projection = map.Projection;
        pointLayer = (MapPointLayer)map.Layers.Add(fsPoint);


        DotSpatial.Symbology.PointSymbolizer symbol = new DotSpatial.Symbology.PointSymbolizer(pointColor, (DotSpatial.Symbology.PointShape.Ellipse), pointSize);
        symbol.SetFillColor(fillColor);
        pointLayer.Symbolizer = symbol;

        pointLayer.Symbolizer.SetFillColor(fillColor);
        pointLayer.Symbolizer.SetOutline(pointColor, 3);
      }

      void addMultiPoint()
      {
        List<Coordinate> multiPointList = new List<Coordinate>();

        for (int i = 0; i < 2000; i++ )
        {
            double lat = 32.0F;
            double lon = 31.0F;
            multiPointList.Add(new Coordinate(lon + i * 0.01, lat + i * 0.001));
        }
        MultiPoint mp = new MultiPoint(multiPointList);
        feature = pointLayer.DataSet.AddFeature(mp);
       }

    void deleteMultiPoint()
    {
       pointLayer.DataSet.Features.Remove(feature);
    }

    void testCode()
    {
    addPointLayer(Color.Blue, 3, Color.Red);
    addMultiPoint();
    deleteMultiPoint();
    addMultiPoint();
    deleteMultiPoint();
    addMultiPoint();
    deleteMultiPoint();
    addMultiPoint();
    deleteMultiPoint();
    GC.Collect();
    }