Fr0sT-Brutal / Delphi_OSMMap

Visual control for Delphi and Lazarus to display OSM map
Mozilla Public License 2.0
65 stars 22 forks source link

processor load of up to 80% #2

Closed AlexHausauer closed 3 years ago

AlexHausauer commented 4 years ago

What could be the reason for a constant processor load of up to 80%, after downloading a tile from the Internet?

Fr0sT-Brutal commented 4 years ago

Hmm, that's weird. Is that happens after download only (OK using cache)? What network engine you use? What happens if you try another one?

AlexHausauer commented 4 years ago

Yes, this happens as soon as the tile is downloaded via the Internet, and then it constantly loads the processor by 80%. But the problem was solved. During the loading of the tile, threads are created (I have 2 of them) and after the download is complete they will not end, but continue to work in an infinite loop. Added a delay of 10 ms to the TNetworkRequestThread.Execute procedure and the problem was solved. Now the processor load is 0% in idle mode.

procedure TNetworkRequestThread.Execute; var ... begin ... while not Terminated do begin pT := PTile(FOwner.PopTask); if pT <> nil then begin ... end else sleep(10); end; end;

Fr0sT-Brutal commented 4 years ago

Hmm, thanks for investigation, looks like improper thread finalization. I'll look into it

Fr0sT-Brutal commented 3 years ago

Fixed at last!