Jump to content

Memory Leaks


jasper182

Recommended Posts

I've recently been working with some javascript on a project and I am not very experienced with it.  Anyways, I'm working with doing some simple AJAX, but there is a memory leak somewhere in my page.  After 20 minutes or so FF gets extremely sluggish and needs to be restarted.  I make sure to delete all variables that are created inside of called functions, but other then that I was wondering what else I should look for to stop these memory leaks.  Thanks in advance for any help you can offer me.
Link to comment
https://forums.phpfreaks.com/topic/34091-memory-leaks/
Share on other sites

as I understand it, the biggest danger of memory leaks is when you use anonymous functions, ie:
[code]function x() {
    return function () {  return 5; } //anonymous function
}
element.onclick  = function () { alert('hello'); } // another anonymous function
[/code]
Link to comment
https://forums.phpfreaks.com/topic/34091-memory-leaks/#findComment-160763
Share on other sites

The closure concept is the most difficult javascript concept I've come across by far.  In the last month I have read maybe a dozen articles on closures and memory leaks and I still have not gotten a good handle on it.  It seems that the ways in which you can go wrong with closures is numerous and can be devilously sutle. 

I think there are many large web sites that have leak problems.  I have been suspicous for some time that even google pages have a leaking problem because of increased browser lookups I get after using their site.

Is anybody aware of a study someone might have done of memory leaking on major web sites?  I'd be interested in seeing that.  It would seem that you should be able to just use a leaking tool on their web pages without having to have access to their servers.

Link to comment
https://forums.phpfreaks.com/topic/34091-memory-leaks/#findComment-161551
Share on other sites

  • 10 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.