Community of VE/MapPoint Users and Developers
This is a discussion on Memory leak - Bulk calculates within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hello everyone - I've got some VB.Net code using the MapPoint 11.0 COM Objects that are doing bulk calculations of ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Memory leak - Bulk calculates I've got some VB.Net code using the MapPoint 11.0 COM Objects that are doing bulk calculations of distances between two points. Here is the basic workflow: Code: m_oApp.PaneState = geoPaneRoutePlanner
' Ensure we're working in miles
m_oApp.Units = GeoUnits.geoMiles
m_oMap = GetObject(, "MapPoint.Application").ActiveMap
m_oMap.Parent.PaneState = geoPaneRoutePlanner
m_oRoute = m_oMap.ActiveRoute
m_oRoute.Clear()
' Iterate through each row in the data row collection - a row represents an address in the route
For Each dr As DataRow In dsRoutePoints
Dim oLocation As MapPoint.Location
Dim oFindResults As MapPoint.FindResults
oFindResults = m_oMap.FindAddressResults(dr.Item("address").ToString, dr.Item("city").ToString, , _
dr.Item("state").ToString, CStr(dr.Item("zipcode")), "United States")
If oFindResults.ResultsQuality = GeoFindResultsQuality.geoFirstResultGood Then
' The first address seems to be valid - add the waypoint
oLocation = oFindResults(1)
m_oRoute.Waypoints.Add(oLocation)
Else
...
End If
Next
Try
' Calculate the route
m_oRoute.Calculate()
Catch ex As Exception
' Only one waypoint in the row collection - cannot calculate a route
m_oMap.Saved = True
m_oMap = Nothing
ReturnResults.ErrorCode = MapPointStructs.CalculateRouteErrors.OnlyOneWaypoint
Return ReturnResults
Exit Function
End Try
m_oMap.Saved = True
' No errors occurred - distance calcualted. Return the results
ReturnResults.ErrorCode = MapPointStructs.CalculateRouteErrors.NoErrors
ReturnResults.DistanceCalculated = m_oRoute.Distance.ToString
m_oRoute.Clear()
m_oRoute = Nothing
Return ReturnResults
Any ideas? Derek |
| ||||
|
Also try resetting the other objects when you finish with them - eg. the location and result objects. I assume the memory size keeps growing as it does the processing? If so, setting the map object to nothing after the processing won't have any effect unti it isl finished. MapPoint also seems to have a lazy garbage collector, and appears to grow to fill the space available when used on a large batch processing job. If you clear your objects correctly, this should tidy itself up when it closes. Richard
__________________ Winwaed Software Technology LLC http://www.winwaed.com See http://www.mapping-tools.com for MapPoint Tools Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009 |
| |||
|
I tried setting the Map object to nothing on each loop - and it doesnt seem to be doing anything (as well as the Location, and Find Results objects). Also - when the process is finished, MapPoint does not release the memory - it still keeps a good 120 meg to itself. Subsequent iterations of the same batch process do not cause the memory to go any higher...however it does not drop at any time as well. |
| ||||
|
Setting the Map to Nothing probably doesn't gain anything unless you leave it to the end. Does MapPoint stay dormant in memory, even when it is closed down? If so, you have a leaky COM object. When you program finishes, MapPoint will stay big. There are various valid reasons why this might be the case. It has 'taken' memory from the OS to meet requirements, but the bits that are still being used are probably spread throughout this large allocation (or it doesn't know any better). Maybe this is something for a future version - MapPoint should have a garbage collector that can "shrink" the full memory footprint, and can be called programmatically. It would be slow, but could be called at the end of a load of batch processing. You may also observe that MapPoint slows down as the memory footprint grows... (again, I think memory is the issue) Richard
__________________ Winwaed Software Technology LLC http://www.winwaed.com See http://www.mapping-tools.com for MapPoint Tools Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009 |
| |||
|
When I destroy the mappoint application object and close the application - all of the memory is released. I think what I'm going to do is force quit the mappoint application every X batches to release the large memory footprint; then re-open the application object. |
| |||
| Mappoint 2006 Memory Increases
I see a similar pattern using the FindResults method. Mappoint increases in memory after repeated calls to that method even though I explicitly close the reference to it. I guess the solution with Mappoint 2006 is to force quit the mappoint application every X minutes to release the large memory footprint; then re-open the application object. This really blows. How would one report this to MS? |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Deleting pushpins in bulk | brianmcg | MapPoint 2006/2009 Discussion | 1 | 06-22-2006 01:08 PM |
| Handling Route that Calculates but does not Optimize | Eric Frost | MapPoint 2006/2009 Discussion | 4 | 03-07-2005 02:07 PM |
| memory leak with objloc.goto? | mzupan | MapPoint 2006/2009 Discussion | 1 | 08-02-2003 12:14 AM |
| Huge memory leak in using QueryShape? | random0000 | MapPoint 2006/2009 Discussion | 2 | 03-28-2003 05:22 AM |
| I am developing a VB application which calculates .... | Anonymous | MapPoint 2006/2009 Discussion | 2 | 04-04-2002 01:26 AM |
Flights to Kos
Kos has many attractions and it's no secret that one of them is the lively nightlife. Don't miss the historical sites though. For cheap flights to Kos check Holiday Hypermarket.
Italy Weather
Check Italy Weather before you travel. We provide information on Italy including weather, flights and accommodation.
Holidays Jamaica
Holidays to Jamaica are a great way to immerse yourself in a different culture. Soak up some sun, indulge in some shopping, and relax at a beach resort. Use dealchecker.co.uk.
Holidays to Cancun
The Holiday Place has special offers on holidays to Cancun during the month of September. Book a late summer holiday with us!
Holiday
Searching for the perfect holiday? Well check out ULookUBook online to find out all about your destination and also to book a great value holiday.
Compare flight prices
Travel.co.uk makes it easy for you to compare flight prices from hundreds of UK based travel companies.
Cheap Lanzarote Holidays
The Canary Islands beckons you to come! View information on cheap Lanzarote holidays at On The Beach!