jquery - JavaScript clean memory -


i have problem memory management. simpliest code here:

var url="/abrapo.php"; var ob={start_:100, token:null}  function post_token(){   $.post(url,{access:ob.token})    .done(function(data){       console.log(data);       ob=data;     }); } 

i call function post_token every seconds. after 2000 call user has problem of memory, ram goes 2gb. don't need save want log data after post , clear memory. i've googled , find delete ob. not clean memory. increase memory , how can clean without reloading page

use browser's profiling tools determine you're accumulating memory. in chrome these profiling tools located under performance tab in chrome developer tools f12.

  • click memory checkbox near top enable memory profiling
  • click start profiling , reload page (ctrl+shift+e)
  • let profiling run while, pages load in 2-3 seconds sounds page needs run longer that
  • click stop button halt profiling

among other performance graphs, should see 1 memory usage looks this.

enter image description here

you can use see if, , when, browser performing garbage collections on javascript heap. may need manually clear objects setting them null. also, try avoid cyclical references , other complex referencing patterns cause javascript engine hold on objects longer has to.

click here, more memory management , garbage collection in browser.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -