Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cleaning up memory used by javascript objects

 
Fawad Ali
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am a jack in javascript. I am calling a large amount of data through an ajax call periodically and assign it to an array in an object and based on that data I render a chart. I have noticed that after sometime the browser crash by taking up a lot of memory. The example of what I am doing is as under:



I am nulling my object manually but somehow the memory taken by browser is increasing continuously. Whats the best way to avoid any javascript memory leaks.

Thanks in advance.
 
Fawad Ali
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,
Any idea on this?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
cache not crash

Sounds like it is myObj.renderChart(); is taking up the memory. Have you used a profiler in chrome or firefox to see what is up?

Eric
 
Fawad Ali
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No I have not used that. I dont know how to use that. BTW I am using firefox and firebug.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would say download chrome and use theirs since it is better: http://code.google.com/chrome/devtools/docs/profiles.html

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic