MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Memory leak - Bulk calculates

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 ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-05-2004
Junior Member
White Belt
 
Join Date: Nov 2004
Posts: 4
Memory leak - Bulk calculates

Hello everyone -

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
What I have found, however is that the MapPoint.exe in the Task Manager is consistantly going up, and up in memory useage. As you can see I am trying to set the Map Object to nothing - but it doesnt seem to be solving the problem.

Any ideas?

Derek
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 11-05-2004
Winwaed's Avatar
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 787
Blog Entries: 5
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 11-05-2004
Junior Member
White Belt
 
Join Date: Nov 2004
Posts: 4
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 11-06-2004
Winwaed's Avatar
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 787
Blog Entries: 5
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 11-08-2004
Junior Member
White Belt
 
Join Date: Nov 2004
Posts: 4
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 09-29-2006
Junior Member
White Belt
 
Join Date: Sep 2006
Posts: 1
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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

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


All times are GMT -5. The time now is 01:33 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map

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!


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51