By Daniel Du
You many run into the issue of memory leak when working with Autodesk Infrastructure Map Server or MapGuide Enterprise. The memory may increase to a very high level and finally brings down the server, or the server just gets frozen and does not response any more.
Here are some suggestions, hope it is helpful for you.
Firstly, if you are running custom applications, please check your code carefully, to make sure to close the feature reader and release resources as early as possible. You can use following code snippet:
MgFeatureReader reader = featureService.SelectFeatures(); try { //your code here ... } finally { Reader.close(); }
Or :
MgFeatureService featureService
= siteConnection.CreateService(..)
try { using(MgFeatureReader reader
= featureService.SelectFeatures(..)) { // your code here … Reader.close(); } } finally { featureService.dispose(); }
Autodesk Infrastructure Map Server is designed very carefully to avoid memory leak, there are sometimes memory leaks in web-based applications and application servers, given the complexity and number of dependent processes. What might appear to be a minor memory leak can accumulate over time and affect general server performance.
One workaround is to write a routine to occasionally restart your web server service, thereby freeing up orphaned resources. Setting the Autodesk MapGuide service to restart automatically may also help in the event that the service has shut down. Following script to stop and start the service:
net stop InfrastructureMapServer2012
net start InfrastructureMapServer2012
You might want to look at the service log files to determine the cause for the service to stop and rectify it to prevent it in the future.
For more suggestions of best practice, please refer to the MapGuide Best Practice Wiki.