Community of MapPoint and Virtual Earth Users and Developers
This is a discussion on MP eats up Ram with multiple routes despite clearing. within the Development forums, part of the MapPoint 2006/2009 Discussion category; I'm running batches of zipcodes thru MP2006/2009 to calculate driving distances between them. Automated via C# which sets Waypoints, gets ...
| |||||||
| Today's Posts | Twitter Feed | Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| MP eats up Ram with multiple routes despite clearing. Sample code: MapPoint.ApplicationClass objApp = new MapPoint.ApplicationClass(); MapPoint.Map objMap = null; objApp.Visible = false; //make map not show or launch window objMap = objApp.ActiveMap; MapPoint.FindResults findResults1 = objMap.FindResults(braddr); MapPoint.FindResults findResults2 = objMap.FindResults(custaddr); objMap.ActiveRoute.Waypoints.Add(objMap.FindResult s(braddr).get_Item(ref obj1), ""); objMap.ActiveRoute.Waypoints.Add(objMap.FindResult s(custaddr).get_Item(ref obj1), ""); objMap.ActiveRoute.Calculate();//calculates map and route distance = (objMap.ActiveRoute.Distance * 2);//doubled for roundtrip numbers objMap.ActiveRoute.Clear();//clears out route info objApp.ActiveMap.Saved = true;//remove pesky popup requesting you to save map objApp.Quit();//make mappoint.exe close -- takes a few seconds (in the background) objApp = null; Pretty standard stuff. But the constant opening and closing of Mappoint makes it slow and MP doesn't always get closed before it's asked to open again. So I rewrote the code so I open MP once, then loop thru my pairs of zips and when finished close MP. This works fine and is faster BUT... With Task Manager open I can see MP eating up RAM, about 2k-5K per calculation and despite telling it to CLear the route I NEVER see the memory used go down , it just keeps incrementing upwards. When it hits 450M it stops because my sever says "enough!" Any ideas on how to make it release the memory it's chewing up? Last edited by oran; 10-03-2008 at 09:04 AM.. |
| ||||
| Re: MP eats up Ram with multiple routes despite clearing.
This is to do with garbage disposal. MapPoint is pretty lazy when it comes to garbage disposal and will do what you describe until physical memory becomes a problem. Considering MapPoint is primarily designed for GUI users, this makes sense. (although a manual GC call in the API would be useful!). One solution is to minimize and maximize MapPoint. You have to do this through the Windows API - it doesn't work if you use the app windowstate property. <shameless plug for one of my products> My MPMileage program does batch MapPoint route calculation as well - start/end points are specified in a database. On a modern PC, I bet it is quicker than your code! MPMileage: Batch calculate mileages with Microsoft MapPoint Richard
__________________ Winwaed Software Technology LLC http://www.winwaed.com See http://www.mapping-tools.com for MapPoint Tools See the Geoweb Guru for online mapping |
| |||
| Re: MP eats up Ram with multiple routes despite clearing. Quote:
-or- I am not this advanced yet ... there probably is a way to look at the process and when it gets over 250M shut down MP and restart it, which would be a better way of doing it. ([vb.net] monitor process' memory usage - Neowin Forums) ... haven't tried it ... shot in the dark. obviously the code would have to run along side the code you listed. which would slow things up a bit. |
| ||||
| Re: MP eats up Ram with multiple routes despite clearing.
Counting successful routes and restarting works. At what point the restart occurs is a matter of choice. As memory is used up, MapPoint runs slower. But the restart process itself takes extra time. When is the optimum? Richard
__________________ Winwaed Software Technology LLC http://www.winwaed.com See http://www.mapping-tools.com for MapPoint Tools See the Geoweb Guru for online mapping |
![]() |
| Tags |
| clearing, eats, multiple, ram, routes |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help with multiple routes | madrover | MapPoint 2006/2009 Discussion | 3 | 07-30-2006 10:46 AM |
| Multiple Routes | wadams | MapPoint 2006/2009 Discussion | 0 | 11-17-2005 09:28 AM |
| Multiple routes | Anonymous | MapPoint 2006/2009 Discussion | 2 | 03-23-2005 01:11 PM |
| Multiple routes | tanguy_laverdure | MapPoint 2006/2009 Discussion | 0 | 02-27-2004 09:14 AM |
| Multiple Routes on 1 Map | Anonymous | MapPoint 2006/2009 Discussion | 0 | 09-10-2003 09:45 PM |