MapPoint Forums

MapForums

Community of MapPoint and Virtual Earth Users and Developers




Huge memory leak in using QueryShape?

This is a discussion on Huge memory leak in using QueryShape? within the MapPoint 2006/2009 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 ...


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

Today's Posts Twitter Feed Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-28-2003
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
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 03-28-2003
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?
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 03-28-2003
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 ;-)
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

Tags
huge, leak, memory, queryshape


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
Memory leak - Bulk calculates bigderek MapPoint 2006/2009 Discussion 7 10-08-2008 06:50 AM
Huge Number of Drive Times lbequis MapPoint 2006/2009 Discussion 3 08-27-2005 08:31 AM
Problem with dataset.QueryShape Method Ray Liu MapPoint 2006/2009 Discussion 1 07-15-2004 10:55 AM
memory leak with objloc.goto? mzupan MapPoint 2006/2009 Discussion 1 08-02-2003 12:14 AM
QueryShape problem Please help Anonymous MapPoint 2006/2009 Discussion 2 03-13-2003 08:57 AM


All times are GMT -5. The time now is 03:08 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 RC2
MP2K Magazine
Visitor Map

Costa Brava Holiday
Beautiful kilometres of sandy beaches await you should you choose a Costa Brava holiday through UlookUbook!



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 52 53 54 55 56 57 58 59