Hi, i cant do this because im getting this compiler error:
,OSGeo.MapGuide.MgFeatureReader': type used in a using statement must be implicitly convertible to 'System.IDisposable' From: [email protected] [mailto:[email protected]] On Behalf Of Frank Misurec Sent: Monday, August 16, 2010 3:15 PM To: 'MapGuide Users Mail List' Subject: RE: [mapguide-users] featureService.SelectFeatures and memory consumption Try and wrap your SelectFeatures call within a using statement: using (MgFeatureReader fReader = featureService.SelectFeatures(LeidimuResId, "FeatureName", Query)) { } From: [email protected] [mailto:[email protected]] On Behalf Of Vaidas Velutis Sent: August 16, 2010 6:57 AM To: [email protected] Subject: [mapguide-users] featureService.SelectFeatures and memory consumption Hello, I have found that after calling featureService.SelectFeatures , memory is not realeased. Here is my source code: MgUserInformation userInfo = new MgUserInformation("Adminitrator", "admin"); MgSiteConnection siteConnection = new MgSiteConnection(); siteConnection.Open(userInfo); MgFeatureService featureService = (MgFeatureService)siteConnection.CreateService(MgServiceType.FeatureService) ; MgFeatureQueryOptions Query = new MgFeatureQueryOptions(); double d11 = X - prec; double d12 = Y - prec; double d21 = X + prec; double d22 = Y - prec; double d31 = X + prec; double d32 = Y + prec; double d41 = X - prec; double d42 = Y + prec; MgWktReaderWriter wktReaderWriter = new MgWktReaderWriter(); MgGeometry geometry = wktReaderWriter.Read("POLYGON XY ((" + d11.ToString() + " " + d12.ToString() + ", " + d21.ToString() + " " + d22.ToString() + ", " + d31.ToString() + " " + d32.ToString() + ", " + d41.ToString() + " " + d42.ToString() + ", " + d11.ToString() + " " + d12.ToString() + "))"); Query.SetSpatialFilter("Geometry", geometry, MgFeatureSpatialOperations.Intersects); MgResourceIdentifier ResId = new MgResourceIdentifier("FeatureSource"); MgFeatureReader fReader = featureService.SelectFeatures(LeidimuResId, "FeatureName", Query); fReader.Close(); After calling this couple hundred times, i get this error in MapGuide error log: Error: Out of memory. bad allocation In process manager i can see that after each call mapguide.exe process is using more and more memory. Is this a bug or i am doing something wrong? Thanks.
_______________________________________________ mapguide-users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/mapguide-users
