MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Mappoint eats up my cpu bit by bit.

This is a discussion on Mappoint eats up my cpu bit by bit. within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hello dear programmers, I'm developing an application with Mappoint using VC++. What I'm doing is getting a position from the ...


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

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



Click here to register

Reply

 

LinkBack (2) Thread Tools Display Modes
  2 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 11-28-2006
Member
Green Belt
 
Join Date: Nov 2006
Posts: 87
Thumbs up Mappoint eats up my cpu bit by bit.

Hello dear programmers,

I'm developing an application with Mappoint using VC++.
What I'm doing is getting a position from the GPS and put a smalle circle on the map. For testing I use a "static" GPS (in our office) that doesn't move, we just use it for testing. It all works well the GPS sends every second a new position (wich is finally the same position).

But the problem is it seems that every position I get, mappoint needs more processingtime. So after a few minutes, mappoint has to process about 300 pushpins, and than the processorfan really has to cool the cpu, because Mappoint sucks almost all of the cpu.

What I did is making a new pushpin everytime I get a new position.
And if I want to follow a vehicle on the map with its trace (these are the old pushpins on the map) than Windows will crash after 5 minutes.

So how can I solve this situation?

Again, I use this everytime I get a new position:

m_Loc = m_Map.GetLocation(Lat, Lon, 1);
m_Pin = m_Map.AddPushpin(m_Loc.GetLocation(), Txt);
m_Pin.SetSymbol(21);
m_Loc.GoTo();

I hope somebody can help me, so thank you very much
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-28-2006
Member
Green Belt
 
Join Date: Nov 2006
Posts: 87
Re: Mappoint eats up my cpu bit by bit.

Hi,

I'm sorry I forget to mention that RAM-memory doesn't leak, so there is no memory leakage, only the cpu usage get's 100% by Mappoint only. I mean mappoint as an ActiveX ofcourse
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-29-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,112
Re: Mappoint eats up my cpu bit by bit.

Hi,

300 pushpin is not so mutch because the map does not to handle all 300, only 1 comes new every second. Maybe the problem is because you have honderds pushpins on same location with the test ?
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-29-2006
Member
Green Belt
 
Join Date: Nov 2006
Posts: 87
Re: Mappoint eats up my cpu bit by bit.

Thank you for your reaction Wilfried,

I don't think it has to do with the same position on the map. An the reason I think so is, I have another project wich I use it for experimenting things with mappoint.

And the funny thing is, that I don't have that problem, though I have 500 pushpins, the cpu load remains the same. Only the RAM increases a little bit (you can see a very small change).


So I've to figure out what's the cause of increasing the cpu-load. It's a little bit difficult to find out, because I used cut&paste, so I don't see differences in code....

I hope someone can give a tip/tric to solve this. If I find the cause, I'll report it to you immediatly.
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-29-2006
Member
Green Belt
 
Join Date: Nov 2006
Posts: 87
Re: Mappoint eats up my cpu bit by bit.

Hello programers,

I found out what the evil bug is (actually it's more a bad coding of mine ).
If you look at the code below:

void SomeFunction()
{
m_Loc = m_Map.GetLocation(dLat, dLon, 1);
m_Pin = m_Map.AddPushpin(m_Loc.GetLocation(), Txt);
m_Loc.GoTo();
}


Everytime I get a new latitude. longitude, I call this function to draw on the map. But by a wrong coding, Txt has the same string. Than something goes wrong, I don't really understand what's going on in Mappoint.
But somehow if I add a pushpin on the same location with the same NAME (that's Txt stands for) than uses more processingtime.

Can somebody explain me why that is? Because I didn't really dive in the mappoint API, I just looked for the needed functions to call, to make my application work.


I hop somebody can tell me why Mappoint behaves like that.
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 11-29-2006
Junior Member
White Belt
 
Join Date: Nov 2006
Posts: 4
Re: Mappoint eats up my cpu bit by bit.

Do i understand you right? You add pushpins with AddPushpin(aLocation, aName) and this adding gets slower for every pushpin you add?
If this is the case, I encountered the same problem during performance tests and found an easy but strange solution:
don't use
AddPushpin(aLocation, aName);

try this one:
pin = AddPushpin(aLocation, "");
pin->Name = aName;


don't ask my why this is faster, but it's really much faster, the more pushpins you already have the greater the speedup is.

Example:
Adding 256 pushpins to a map with an empty string as name took 4.185 seconds
Adding 256 pushpins to a map with "moo" als name took 39.841 seconds
Adding 256 pushpins to a map with an empty string as name followed by pin->Name = "moo" took 6.177 seconds

It's even worse with 1024 pins:
No name: 13.269 seconds
"moo" as name: 38 minutes and 32.676 seconds!
No name followed by pin->name = "moo": 23.352 seconds

by the way, the length of the name makes only a small difference, if it's 1 character long or 50 doesn't really matter.

edit: and using different names for each pushpin doesn't matter too if i remember right (and my pushpins had 1° distance between each other)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 11-29-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,112
Re: Mappoint eats up my cpu bit by bit.

Hi,

Thanks for feedback. Ok so that is the reason I did never encountered this problem because in each application all pushpins have exclusive name.

Probably it has something to do with database management. I assume there is an internal index on the pushpin's name, so a internal search to it bounces on the same over and over again. Probably it increment the internal index until EOF or name change.

I can not come to a better explanation / reason... But the nice thing is that problem is found
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 12-01-2006
Member
Green Belt
 
Join Date: Nov 2006
Posts: 87
Re: Mappoint eats up my cpu bit by bit.

Well,

I hope other programmers have value information about this and I want to thank all of you.
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
bit, cpu, eats, mappoint


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/mappoint-eats-up-my-cpu-bit-bit-5410.html

Posted By For Type Date
The Magazine for MapPoint - MP2K Magazine This thread Refback 11-30-2006 05:24 AM
The Magazine for MapPoint - MP2K Magazine This thread Refback 11-30-2006 04:30 AM

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


All times are GMT -5. The time now is 06:17 AM.


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


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