Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 3 of 3

Huge memory leak in using QueryShape?

This is a discussion on Huge memory leak in using QueryShape? within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi all, Each time I call the below VB.NET code the memory usage of MapPoint increases up to 1-2mb. This ...

  1. #1
    random0000 is offline Junior Member White Belt
    Join Date
    Mar 2003
    Posts
    4

    Huge memory leak in using QueryShape?

    Hi all,

    Each time I call the below VB.NET code the memory usage of MapPoint increases up to 1-2mb. This continues to increase until around 90-100mb when the application dies. The only way I have been able to prevent this is to completely create and destroy the mappoint object for every time I want to perform a region check on a location check (very slow obviously). The best solution would be to keep the mappoint application persistent (with map/shapes loaded) and then do a location check.

    Has anyone else had this issue or found a solution to the memory problem?

    Thanks!

    oLocation = oMap.FindAddress(Street, City, State, Zip, MapPoint.GeoCountry.geoCountryUnitedStates)
    If Not oLocation Is Nothing Then
    oPushpin = oMap.AddPushpin(oLocation, "Home")

    For Each mShape In oMap.Shapes
    If mShape.Type < MapPoint.GeoShapeType.geoLine Then
    For Each mData In oMap.DataSets
    mRst = mData.QueryShape(mShape)
    mRst.MoveFirst()
    Do While mRst.EOF = False
    If mRst.Location.StreetAddress.Value = oLocation.StreetAddress.Value Then
    Console.WriteLine("Senate District: " & mShape.Name)
    If sDistrict = "" Or sDistrict = "SD1" Then
    sDistrict = mShape.Name
    End If
    Exit For
    End If
    mRst.MoveNext()
    Threading.Thread.Sleep(1)
    Loop
    mRst = Nothing
    mData = Nothing
    Next mData
    End If
    Next mShape
    oPushpin.Delete()
    oPushpin = Nothing
    oLocation = Nothing
    End If
    oMap.Saved = True
    GC.Collect()
    Return sDistrict

  2. #2
    random0000 is offline Junior Member White Belt
    Join Date
    Mar 2003
    Posts
    4

    Quick Update...

    Just discovered that this only happens in the VB.NET version and not in VB6. Probably a bug in the interop DLL or something... how does one go about reporting this as a bug to MS?

  3. #3
    random0000 is offline Junior Member White Belt
    Join Date
    Mar 2003
    Posts
    4

    And finally...

    Well it turns out that to properly dispose of COM objects in .NET you cannot simply use the = Nothing statement. You must first use ReleaseComObject(oObject) and then set the object to nothing. An article is at http://support.microsoft.com/default...;EN-US;Q317109.

    So now you know ;-)

    P.S. Been real nice talking to myself on this forum ;-)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Memory leak - Bulk calculates
    By bigderek in forum MapPoint Desktop Discussion
    Replies: 7
    Last Post: 10-08-2008, 06:50 AM
  2. Huge Number of Drive Times
    By lbequis in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 08-27-2005, 08:31 AM
  3. Problem with dataset.QueryShape Method
    By Ray Liu in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 07-15-2004, 10:55 AM
  4. memory leak with objloc.goto?
    By mzupan in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 08-02-2003, 12:14 AM
  5. QueryShape problem Please help
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 03-13-2003, 08:57 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


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