PDA

View Full Version : Problem With jsDOMenubar - Memory Leak in IE



gandalf97
03-30-2007, 04:52 PM
1) Script Title: jsDOMenubar

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex1/jsdomenubar/index.htm

3) Describe problem:

I have been trying to replace my current menu (menubarAPI4.js) because of numerous script errors it causes. I chose jsDOMenubar because it seemed the best suited for my immediate needs as well as long range plans to generate custom menus based on user security. I spent 3 days writing and debugging the functions that build all the menus and submenus until I thought they worked. When I started doing more rigorous testing, I found that my browser was leaking memory at the rate of about 8MB per navigation. It only took a few clicks before the menu became so slow as to be unusable.

I'm really stuck. I can't spend huge amounts of time to modify the old menubar code to get rid of all the errors and I can't use the new one as-is because of the massive leak. I've done some research on memory leaks and tried some of the simpler onunload functions to cleanup potential sources of leaks with no luck. Schemes like event-cache look promising but it looks like I'd have to make a lot of mods to the menu script.

I know John Scheuer was working on something having to do with memory leaks... John, if you see this... PLEASE!!! Help.

Thanks in Advance,
Gandalf

ddadmin
03-30-2007, 09:21 PM
Hi Gandalf:
What version of IE are you seeing the leak? I did a quick test in IE7, and didn't discern any memory leaks. This is a rather complex script, so I don't think it's realistic for anyone other than the author to be able to address subtle issues like this. I've sent an email to the author alerting him of this thread, in case he has a quick fix at hand.

Twey
03-30-2007, 09:56 PM
Eight megs per load? Ouch! It would help if you were to link to your page.

gandalf97
04-02-2007, 12:28 PM
ddadadmin,

I think that the e-mail to the author will be a big help. I am using IE6 by the way and IE7 is waaaaaaayy down the road. My client is a big company and they move very slowly on stuff like version upgrades.

Twey,
Yes 8MB really kills me. Unfortunately, the site I am working on is an intranet site and is behind a firewall and I can't get access for anyone outside the company. In addition, any code I do post has to be heavily sanitized. Because of the amount of code involved, it really isn't feasible for me to post much code. This means that though I appreciate the offer to look at the page, I am limited to asking questions and posting small snippets.

Why I think it is something about the menubar...
When I implemented the new one, I kept the old one around and I coded it such that all I have to change are a few lines in an include file to switch back and forth. Sure enough, switching back to the old menubar gave a ver slight leak and then switching back to the new and I was leaking around 8MB/load again.

Please let me know if the author answers. I'd be happy to work with him as much as I can to figure out what the problem is.

Regards,
Gandalf

zhiqiang
04-04-2007, 08:12 AM
Hi,

I am the author. I knew the memory leak issue long before. I have an unrelease beta version that may be useful. Please see the attachments.

Specifically, please check out the function releaseMemory and menuBarReleaseMemory. It may be possible to copy these two functions to resolve the issue, but I never try it before.

In case you miss out, the last line in jsdomenu.js calls releaseMemory onunload:


window.onunload = releaseMemory;

Note: The beta version may not be compatible with previous version as I have changed some function names. Still, it should be useful.


ddadadmin,

I think that the e-mail to the author will be a big help. I am using IE6 by the way and IE7 is waaaaaaayy down the road. My client is a big company and they move very slowly on stuff like version upgrades.

Twey,
Yes 8MB really kills me. Unfortunately, the site I am working on is an intranet site and is behind a firewall and I can't get access for anyone outside the company. In addition, any code I do post has to be heavily sanitized. Because of the amount of code involved, it really isn't feasible for me to post much code. This means that though I appreciate the offer to look at the page, I am limited to asking questions and posting small snippets.

Why I think it is something about the menubar...
When I implemented the new one, I kept the old one around and I coded it such that all I have to change are a few lines in an include file to switch back and forth. Sure enough, switching back to the old menubar gave a ver slight leak and then switching back to the new and I was leaking around 8MB/load again.

Please let me know if the author answers. I'd be happy to work with him as much as I can to figure out what the problem is.

Regards,
Gandalf

gandalf97
04-05-2007, 02:38 PM
Thanks for posting this. I'm not sure I will have time to try it today, but I will definately look at it.

Regards,
Gandalf