Bug Tracker

Opened 14 years ago

Closed 12 years ago

Last modified 11 years ago

#3299 closed bug (invalid)

Memory leaks when using opacity on overlay for a dialog

Reported by: dbegent Owned by:
Priority: major Milestone: 1.3
Component: core Version: 1.2.6
Keywords: memory leak dialog overlay opacity Cc: [email protected]
Blocked by: Blocking:


I am currently experiencing a rise in 9+Mb in memory usage when I have an opacity setting set on a dialog I'm using. Without the opacity setting the leak doesn't happen.

I've included some test code below (and attached) including descriptive text as to where the bug happens.

Initially the issue occurs here:

document.documentElement[ method ] method = "scrollTop"

on line 3522 of jquery-1.2.6.js

However, if I comment out this line I then get the same problem here:

pLeft += (wnd.width() - this.uiDialog.width()) / 2;

on line 7812 of jquery.ui.all.js

For this last line, the leak happens when you call either the wnd.width() or the this.uiDialog.width() functions. I have been using this within Visual Studio and can cause the memory leak just by putting the wnd.width() into the Watch window.

This does not happen in Firefox, just (from what I've tested so far) in IE 6 and 7

Any ideas why this is happening or how to prevent it?

<!-- Test code... --> <html>


<!-- JQuery --> <script type="text/javascript" src='./JavaScripts/jquery-1.2.6.js' ></script> <script type="text/javascript" src='./JavaScripts/jquery.form.js' ></script> <script type="text/javascript" src='./JavaScripts/jquery.ui.all.js' ></script> <script>

var test = new Test();

$(document).ready(function() {



delete test;

function Test() {

this.hookupLinks = function() {

Set up the dialog popup from the link $('.test').click(runTest);


function runTest() { var dialogContainerName = "#dialogContainer";

$(dialogContainerName).text("Now check if the memory allocated to this window has gone up..."); $(dialogContainerName).show(); $(dialogContainerName).dialog({

title: "Testing memory leak",

modal: true, overlay : {opacity: 0.5, "background-color" : "#808080" }, height : 120, width : 250, resizable: false, position: "center", buttons: {

'Yes': function() {

$(this).dialog('destroy'); return true;

}, 'No': function() {

$(this).dialog('destroy'); return true;



}); }



</head> <body>


<a class="test" href="javascript:void(0)" title="Testing the memory leak when dialog opens">Click here to open dialog</a><br /> Removing the opacity from the overlay stops the memory leak. Keeping this in causes the memory leak at these points:



document.documentElement[ method ] method = "scrollTop" <br /> in jquery-1.2.6.js on line 3522


<br /><br />Removing this line causes the leak to happen at this point<br /><br />


pLeft += (wnd.width() - this.uiDialog.width()) / 2;<br /> on line 7812 of jquery.ui.all.js


<br /><br />This leak happens when either the wnd.width() or the this.uiDialog.width() is called. I can step into this and cause the memory leak whilst in debug just by putting a watch on either of these 2 calls

<div id="dialogContainer" title="Confirm Delete" style="display:none;"></div>



</html> <!-- End Test code... -->

Attachments (1)

jqueryproblem.zip (119.8 KB) - added by dbegent 14 years ago.
Zip file containing all test code and folders

Download all attachments as: .zip

Change History (2)

Changed 14 years ago by dbegent

Attachment: jqueryproblem.zip added

Zip file containing all test code and folders

comment:1 Changed 12 years ago by ajpiano

Resolution: invalid
Status: newclosed

Closing as invalid. This is the bug tracker for jQuery bugs only, not jQuery UI. Additionally, this bug is resolved in recent releases of jQuery UI

Note: See TracTickets for help on using tickets.