[mapguide-users] featureService.SelectFeatures and memory consumption

Vaidas Velutis vaidas at infoera.lt
Tue Aug 17 01:00:35 EDT 2010


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: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] 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: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Vaidas Velutis
Sent: August 16, 2010 6:57 AM
To: mapguide-users at lists.osgeo.org
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.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20100817/74a4c99f/attachment.html


More information about the mapguide-users mailing list