-
16 Oct 2006 11:55 AM #1
problem with memory leak
problem with memory leak
Hello,
Ive got the problem with memory leak. I use IE engine and when I refresh the page (clicking F5 in IE) the browser has increased the memory by about 500kB to 1MB. Its terrible.
When I remove Your extension to YUI I mean the line:
memory is stable and does not leak.Code:<script></script>
Have You any idea of how to resolve this problem ?
Peter
-
16 Oct 2006 12:02 PM #2
Just because the memory increases when you reload a page doesn't indicate a leak. It could indicate IE is caching things. 95% Leaks in IE are created by putting JS Objects on DOM nodes and I never do that. However, if you can point me to a link with the problem, I'd be happy to test it for leaks.
-
16 Oct 2006 12:32 PM #3
The test page is located at:
http://interpc.pl/~pwywiol/test/splitter.htm
It's almost an empty page (with dblClick on splitter
implemented by code You sent me).
Try refresh the page to see the memory used by the browser increase. I test it only on IE engine.
I add the purge function to the javascript code. Now the memory leak slowly.
Peter
-
16 Oct 2006 12:54 PM #4
It could be because you are using legacy event handlers. Try using YAHOO.util.Event for load and unload and see if that changes anything.
Inline load and unload handlers aren't cleaned up and could prevent normal cleanup.Code:YAHOO.util.Event.on(window, 'load', yourLoadFcn); YAHOO.util.Event.on(window, 'unload', yourUnloadFcn);
-
30 Nov 2006 8:10 AM #5
first of all, this stuff really *rocks*
i came across this site searching for a grid widget and i found a lot more.
now, i tested:
http://www.jackslocum.com/blog/examples/layout1.htm
with drip to check MSIE memory.
drip does not find any leak, however memory usage increment on every reload by 1M.
it goes like this (Mb): 16,17,18,19...100,101,102.... etc, etc. and memory get freed only restarting drip.
if it is not a leak, why IE keep eating memory on every refresh ?
-
30 Nov 2006 9:07 AM #6
could IE be caching each instance of the JS pulled, due to the fact it's being served via php?
on a side note:
Does that include using onClick for dom nodes? If so looks like I am going to need to refactor a lot of my work.95% Leaks in IE are created by putting JS Objects on DOM nodes
-
30 Nov 2006 9:18 AM #7
I think that depends on how you handle adding the onclick event. I think there was some discussion about how the yui-ext event model deals with this - not sure if on the blog or here. Here's a article that talks about some of the issues too.
http://javascript.crockford.com/memory/leak.html
This site has a lot of good articles about javascript - Crockford is the guy who created the JSON notation.Tim Ryan
Read BEFORE posting a question / BEFORE posting a Bug
Use Google to Search - API / Forum
API Doc (4.x | 3.x | 2.x | 1.x) / FAQ / 1.x->2.x Migration Guide / 2.x->3.x Migration Guide
-
30 Nov 2006 9:25 AM #8
drip reports the same problem on a local copy with normal .js serving.
Originally Posted by jbowman
-
30 Nov 2006 1:56 PM #9
As I said, it is probably IE caching page state. Most modern browsers (FireFox and Safari too) not only cache the scripts in the page but also the state of those scripts. This is how they can do quick forward backward navigation etc. If drip says no leaks, chances are there probably aren't any leaks.

-
30 Nov 2006 1:58 PM #10
jbowman, using legacy event handlers like onclick aren't directly a source of leaks. But if you assign them in javascript where the handler's closure could also be wrapping the same DOM node, there's a high probability for a leak. For example:
That creates a circular reference that is bad. The onclick function has a closure containing the node, and the node has a property (onclick) that contains the function. This is where the big closure scare came from.Code:function foo(node){ node.onclick = function(){ alert(node.id + ' was clicked.'; } }
Similar Threads
-
iframe cause memery leak in IE6?
By jasspier in forum Ext 1.x: BugsReplies: 5Last Post: 26 Sep 2007, 4:39 AM -
[SOLVED] Memory Leak in Paging Grid Example?
By cobnet in forum Ext 2.x: Help & DiscussionReplies: 7Last Post: 3 May 2007, 8:24 PM -
Grid DataModel keeps data in memory
By tane in forum Ext 1.x: Help & DiscussionReplies: 2Last Post: 24 Feb 2007, 12:38 PM -
Memory Leak issue when using startAutoRefresh
By wanderingwalrus in forum Ext 1.x: Help & DiscussionReplies: 2Last Post: 6 Feb 2007, 9:32 PM -
Border Layout : Too Much Memory Consumption & CPU Usage
By saasira in forum Ext 1.x: BugsReplies: 1Last Post: 5 Dec 2006, 5:41 AM


Reply With Quote