Adding shp file meets outofmemory exception!

Jan 5, 2012 at 7:18 AM
Edited Jan 5, 2012 at 7:20 AM

Hi all,

using the codes below to create a shp file and after save it ,then add to mapcontrol,meet exception !

but if the for_loop's count is 100,there is no exception !


           string file = Application.StartupPath + "\\pointfile.shp";

            Random rnd = new Random(DateTime.Now.Millisecond);
            FeatureSet fs = new FeatureSet(FeatureType.Point);
            for (int i = 0; i < 10000;i++ )
                Coordinate c = new Coordinate(0 + rnd.NextDouble() * 1000, 0 + rnd.NextDouble() * 1000);

                IFeature f = new Feature(c);
               IFeature addf= fs.AddFeature(f);
               addf.DataRow["ID"] = "中国人民"+i.ToString();
            fs.SaveAs(file, true);
           IMapLayer maplayer= map1.AddLayer();

Who knows why ,can you tell me the reason or give me a tips or a solution?

Jan 6, 2012 at 12:20 AM

oh,no one knows why?

waiting for all of you to answer me

Jan 6, 2012 at 7:32 PM

There seem to be some limitations on size at this time, so you may want to use the smaller file.

Jan 9, 2012 at 11:33 AM

It's a well-known error. This error was reported as error some time ago, but is still open.