Jump to content

Geolocation & memory leak


Craig Hopson

Recommended Posts

hi all new day new problem... ok i THINK the problem i'm having is memory leak but not shore. my script logs user location as they move, if you look at http://chsites.co.uk/track/www/index.html Tracking ID = 97Send at most every (sec) = 5Minimum Accuracy (meters) = 100000 then open your debug console (i have some notes in there still debugging) you will see that it logs every 5 seconds all good it works BUT after some time it will lock up the browser and eventually crash italso problem 2 it will post multi times like 3 times at once how can i stop that so to recap...problem 1:- browser locking up after some time.problem 2:-multi posting. Thanks

Link to comment
Share on other sites

The reason you're using all of the memory is because you keep adding listeners via watchposition. You only need to call that function once to set the success and error listeners. Every time you call StartTracking you add another set of event listeners. That takes memory, you're making an enormous call stack to run when the position changes. If you call StartTracking 1000 times, then you're registering 1000 sets of event listeners and when the position changes it's going to call the success function 1000 times. If you want to check the current position then use getCurrentPosition. I suspect that's probably related to the post issue but I'm not going to test that because, no offense, but you don't need my latitude and longitude. I have that disabled for a reason.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...