Skip to main content

Bug Tracker

Side navigation

#3299 closed bug (invalid)

Opened August 29, 2008 11:00AM UTC

Closed November 08, 2010 04:33PM UTC

Last modified March 14, 2012 06:55PM UTC

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:
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... -->



<!-- 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>


var test = new Test();

$(document).ready(function() {



delete test;

function Test() {

this.hookupLinks = function() {

// Set up the dialog popup from the link



function runTest() {

var dialogContainerName = "#dialogContainer";

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



title: "Testing memory leak",

modal: true,

overlay : {opacity: 0.5, "background-color" : "#808080" },

height : 120,

width : 250,

resizable: false,

position: "center",

buttons: {

'Yes': function() {


return true;


'No': function() {


return true;










<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>




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

Attachments (1)
  • (119.8 KB) - added by dbegent August 29, 2008 11:02AM UTC.

    Zip file containing all test code and folders

Change History (1)

Changed November 08, 2010 04:33PM UTC by ajpiano comment:1

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