aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Cleaning up memory used by javascript objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Cleaning up memory used by javascript objects" Watch "Cleaning up memory used by javascript objects" New topic
Author

Cleaning up memory used by javascript objects

Fawad Ali
Ranch Hand

Joined: Dec 28, 2009
Posts: 112
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.


Regards, Fawad Ali.
Software Engineer, Stafona Inc. - My Blog
Fawad Ali
Ranch Hand

Joined: Dec 28, 2009
Posts: 112
Guys,
Any idea on this?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Dec 28, 2009
Posts: 112
No I have not used that. I dont know how to use that. BTW I am using firefox and firebug.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
I would say download chrome and use theirs since it is better: http://code.google.com/chrome/devtools/docs/profiles.html

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cleaning up memory used by javascript objects
 
Similar Threads
Dynamic Casting
How to create 2-dimensional array
[Newbie] What'is the best practice?
garbage collection
From the office.