Jump to content

Geolocation & memory leak


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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...