[mapguide-users] featureService.SelectFeatures and
memory consumption
Frank Misurec
frank.misurec at open-minds.ca
Mon Aug 16 08:14:48 EDT 2010
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/20100816/0da2c26b/attachment.html
More information about the mapguide-users
mailing list