Where my function leaks memory in IE?

K

kantix

Here is my function:

function fnc_PopUp(source, title, widthPOP, heightPOP){
var openX = (845/2)-(heightPOP/2);
var openY = (1259/2)-(widthPOP/2);
newDivBckgr = document.createElement('div')
document.body.appendChild(newDivBckgr)
newDivBckgr.className = 'bckgr'

tableDiv = document.createElement('div')

tableDiv.className = 'tableDiv'
tableDiv.style.top = openX + 'px'
tableDiv.style.left = openY + 'px'
tableDiv.align = 'left'
document.body.appendChild(tableDiv)
newTable = document.createElement('table')
newTable.border = 1
newTable.className = 'table'
newTable.cellPadding = '0'
newTable.cellSpacing = '0'
tableDiv.appendChild(newTable)

newTbody = document.createElement('tbody')
newTable.appendChild(newTbody)

newTr = document.createElement('tr')
newTbody.appendChild(newTr)

newTdTitle = document.createElement('td')
newTr.appendChild(newTdTitle)

newImg = document.createElement('img')
newImg.src = "/js/img/close.png"
newTdTitle.appendChild(newImg)
newImg.style.position = 'relative'
newImg.align = 'right'
newImg.style.top = '1px'
newImg.onclick = function() {fnc_ClosePopUp()}
newTxt = document.createTextNode(title)
newTdTitle.className = 'tdTitle'
newTdTitle.appendChild(newTxt)

newiframeTr = document.createElement('tr')
newTbody.appendChild(newiframeTr)

newiframeTd = document.createElement('td')
newiframeTr.appendChild(newiframeTd)

newiframe = document.createElement('iframe')
newiframe.iframeBorder = "0"
newiframe.src = source
newiframe.style.width = widthPOP + 'px'
newiframe.style.height = heightPOP + 'px'
newiframeTd.appendChild(newiframe)
}

function fnc_ClosePopUp(){
document.getElementsByTagName('body')[0].removeChild(tableDiv)
document.getElementsByTagName('body')[0].removeChild(newDivBckgr)
document.body.style.overflow = 'scroll'
}

Btw, i tried this: http://msdn.microsoft.com/library/d...en-us/ietechcol/dnwebgen/ie_leak_patterns.asp
and it didn't helped.
 
D

David Mark

Here is my function:

function fnc_PopUp(source, title, widthPOP, heightPOP){
var openX = (845/2)-(heightPOP/2);
var openY = (1259/2)-(widthPOP/2);
newDivBckgr = document.createElement('div')
document.body.appendChild(newDivBckgr)
newDivBckgr.className = 'bckgr'

tableDiv = document.createElement('div')

tableDiv.className = 'tableDiv'
tableDiv.style.top = openX + 'px'
tableDiv.style.left = openY + 'px'
tableDiv.align = 'left'
document.body.appendChild(tableDiv)
newTable = document.createElement('table')
newTable.border = 1
newTable.className = 'table'
newTable.cellPadding = '0'
newTable.cellSpacing = '0'
tableDiv.appendChild(newTable)

newTbody = document.createElement('tbody')
newTable.appendChild(newTbody)

newTr = document.createElement('tr')
newTbody.appendChild(newTr)

newTdTitle = document.createElement('td')
newTr.appendChild(newTdTitle)

newImg = document.createElement('img')
newImg.src = "/js/img/close.png"
newTdTitle.appendChild(newImg)
newImg.style.position = 'relative'
newImg.align = 'right'
newImg.style.top = '1px'
newImg.onclick = function() {fnc_ClosePopUp()}

Here you created a closure and referenced it in the property of a DOM
element. The scope of the closure includes a reference to this same
DOM element (newImg), creating a circular reference.
newTxt = document.createTextNode(title)
newTdTitle.className = 'tdTitle'
newTdTitle.appendChild(newTxt)

newiframeTr = document.createElement('tr')
newTbody.appendChild(newiframeTr)

newiframeTd = document.createElement('td')
newiframeTr.appendChild(newiframeTd)

newiframe = document.createElement('iframe')
newiframe.iframeBorder = "0"
newiframe.src = source
newiframe.style.width = widthPOP + 'px'
newiframe.style.height = heightPOP + 'px'
newiframeTd.appendChild(newiframe)

}

Here is where the leak is created. You could set newImg to null
before the function returns and the circular reference would be
broken. Or you could change the line that created the closure to:

newImg.onclick = fnc_ClosePopUp;

Then there is no closure created.

Also, note the semicolon at the end of the line.
function fnc_ClosePopUp(){
document.getElementsByTagName('body')[0].removeChild(tableDiv)
document.getElementsByTagName('body')[0].removeChild(newDivBckgr)
document.body.style.overflow = 'scroll'

}

Btw, i tried this:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iete...
and it didn't helped.

Did you read it?
 
G

GArlington

Here is my function:

function fnc_PopUp(source, title, widthPOP, heightPOP){
var openX = (845/2)-(heightPOP/2);
var openY = (1259/2)-(widthPOP/2);
newDivBckgr = document.createElement('div')
document.body.appendChild(newDivBckgr)
newDivBckgr.className = 'bckgr'

tableDiv = document.createElement('div')

tableDiv.className = 'tableDiv'
tableDiv.style.top = openX + 'px'
tableDiv.style.left = openY + 'px'
tableDiv.align = 'left'
document.body.appendChild(tableDiv)
newTable = document.createElement('table')
newTable.border = 1
newTable.className = 'table'
newTable.cellPadding = '0'
newTable.cellSpacing = '0'
tableDiv.appendChild(newTable)

newTbody = document.createElement('tbody')
newTable.appendChild(newTbody)

newTr = document.createElement('tr')
newTbody.appendChild(newTr)

newTdTitle = document.createElement('td')
newTr.appendChild(newTdTitle)

newImg = document.createElement('img')
newImg.src = "/js/img/close.png"
newTdTitle.appendChild(newImg)
newImg.style.position = 'relative'
newImg.align = 'right'
newImg.style.top = '1px'
newImg.onclick = function() {fnc_ClosePopUp()}
newTxt = document.createTextNode(title)
newTdTitle.className = 'tdTitle'
newTdTitle.appendChild(newTxt)

newiframeTr = document.createElement('tr')
newTbody.appendChild(newiframeTr)

newiframeTd = document.createElement('td')
newiframeTr.appendChild(newiframeTd)

newiframe = document.createElement('iframe')
newiframe.iframeBorder = "0"
newiframe.src = source
newiframe.style.width = widthPOP + 'px'
newiframe.style.height = heightPOP + 'px'
newiframeTd.appendChild(newiframe)

}

function fnc_ClosePopUp(){
document.getElementsByTagName('body')[0].removeChild(tableDiv)
document.getElementsByTagName('body')[0].removeChild(newDivBckgr)
document.body.style.overflow = 'scroll'

}

Btw, i tried this:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iete...
and it didn't helped.

Maybe because you are using global vars all over the place?
 
G

GArlington

Here is my function:

function fnc_PopUp(source, title, widthPOP, heightPOP){
var openX = (845/2)-(heightPOP/2);
var openY = (1259/2)-(widthPOP/2);
newDivBckgr = document.createElement('div')
document.body.appendChild(newDivBckgr)
newDivBckgr.className = 'bckgr'

tableDiv = document.createElement('div')

tableDiv.className = 'tableDiv'
tableDiv.style.top = openX + 'px'
tableDiv.style.left = openY + 'px'
tableDiv.align = 'left'
document.body.appendChild(tableDiv)
newTable = document.createElement('table')
newTable.border = 1
newTable.className = 'table'
newTable.cellPadding = '0'
newTable.cellSpacing = '0'
tableDiv.appendChild(newTable)

newTbody = document.createElement('tbody')
newTable.appendChild(newTbody)

newTr = document.createElement('tr')
newTbody.appendChild(newTr)

newTdTitle = document.createElement('td')
newTr.appendChild(newTdTitle)

newImg = document.createElement('img')
newImg.src = "/js/img/close.png"
newTdTitle.appendChild(newImg)
newImg.style.position = 'relative'
newImg.align = 'right'
newImg.style.top = '1px'
newImg.onclick = function() {fnc_ClosePopUp()}
newTxt = document.createTextNode(title)
newTdTitle.className = 'tdTitle'
newTdTitle.appendChild(newTxt)

newiframeTr = document.createElement('tr')
newTbody.appendChild(newiframeTr)

newiframeTd = document.createElement('td')
newiframeTr.appendChild(newiframeTd)

newiframe = document.createElement('iframe')
newiframe.iframeBorder = "0"
newiframe.src = source
newiframe.style.width = widthPOP + 'px'
newiframe.style.height = heightPOP + 'px'
newiframeTd.appendChild(newiframe)

}

function fnc_ClosePopUp(){
document.getElementsByTagName('body')[0].removeChild(tableDiv)
document.getElementsByTagName('body')[0].removeChild(newDivBckgr)
document.body.style.overflow = 'scroll'

}

Btw, i tried this:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iete...
and it didn't helped.

So far you should the code, but not explained the problem...
 
D

David Mark

Here is my function:
function fnc_PopUp(source, title, widthPOP, heightPOP){
var openX = (845/2)-(heightPOP/2);
var openY = (1259/2)-(widthPOP/2);
newDivBckgr = document.createElement('div')
document.body.appendChild(newDivBckgr)
newDivBckgr.className = 'bckgr'
tableDiv = document.createElement('div')
tableDiv.className = 'tableDiv'
tableDiv.style.top = openX + 'px'
tableDiv.style.left = openY + 'px'
tableDiv.align = 'left'
document.body.appendChild(tableDiv)
newTable = document.createElement('table')
newTable.border = 1
newTable.className = 'table'
newTable.cellPadding = '0'
newTable.cellSpacing = '0'
tableDiv.appendChild(newTable)
newTbody = document.createElement('tbody')
newTable.appendChild(newTbody)
newTr = document.createElement('tr')
newTbody.appendChild(newTr)
newTdTitle = document.createElement('td')
newTr.appendChild(newTdTitle)
newImg = document.createElement('img')
newImg.src = "/js/img/close.png"
newTdTitle.appendChild(newImg)
newImg.style.position = 'relative'
newImg.align = 'right'
newImg.style.top = '1px'
newImg.onclick = function() {fnc_ClosePopUp()}
newTxt = document.createTextNode(title)
newTdTitle.className = 'tdTitle'
newTdTitle.appendChild(newTxt)
newiframeTr = document.createElement('tr')
newTbody.appendChild(newiframeTr)
newiframeTd = document.createElement('td')
newiframeTr.appendChild(newiframeTd)
newiframe = document.createElement('iframe')
newiframe.iframeBorder = "0"
newiframe.src = source
newiframe.style.width = widthPOP + 'px'
newiframe.style.height = heightPOP + 'px'
newiframeTd.appendChild(newiframe)

function fnc_ClosePopUp(){
document.getElementsByTagName('body')[0].removeChild(tableDiv)
document.getElementsByTagName('body')[0].removeChild(newDivBckgr)
document.body.style.overflow = 'scroll'

Btw, i tried this:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iete...
and it didn't helped.

Maybe because you are using global vars all over the place?-

That's not the problem, but the fact that he didn't declare newImg
inside the function may shoot down my theory (unless the function is
inside another function.)
 
D

David Mark

Here is my function:
function fnc_PopUp(source, title, widthPOP, heightPOP){
var openX = (845/2)-(heightPOP/2);
var openY = (1259/2)-(widthPOP/2);
newDivBckgr = document.createElement('div')
document.body.appendChild(newDivBckgr)
newDivBckgr.className = 'bckgr'
tableDiv = document.createElement('div')
tableDiv.className = 'tableDiv'
tableDiv.style.top = openX + 'px'
tableDiv.style.left = openY + 'px'
tableDiv.align = 'left'
document.body.appendChild(tableDiv)
newTable = document.createElement('table')
newTable.border = 1
newTable.className = 'table'
newTable.cellPadding = '0'
newTable.cellSpacing = '0'
tableDiv.appendChild(newTable)
newTbody = document.createElement('tbody')
newTable.appendChild(newTbody)
newTr = document.createElement('tr')
newTbody.appendChild(newTr)
newTdTitle = document.createElement('td')
newTr.appendChild(newTdTitle)
newImg = document.createElement('img')
newImg.src = "/js/img/close.png"
newTdTitle.appendChild(newImg)
newImg.style.position = 'relative'
newImg.align = 'right'
newImg.style.top = '1px'
newImg.onclick = function() {fnc_ClosePopUp()}
newTxt = document.createTextNode(title)
newTdTitle.className = 'tdTitle'
newTdTitle.appendChild(newTxt)
newiframeTr = document.createElement('tr')
newTbody.appendChild(newiframeTr)
newiframeTd = document.createElement('td')
newiframeTr.appendChild(newiframeTd)
newiframe = document.createElement('iframe')
newiframe.iframeBorder = "0"
newiframe.src = source
newiframe.style.width = widthPOP + 'px'
newiframe.style.height = heightPOP + 'px'
newiframeTd.appendChild(newiframe)

function fnc_ClosePopUp(){
document.getElementsByTagName('body')[0].removeChild(tableDiv)
document.getElementsByTagName('body')[0].removeChild(newDivBckgr)
document.body.style.overflow = 'scroll'

Btw, i tried this:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iete...
and it didn't helped.

So far you should the code, but not explained the problem...-

The problem is a memory leak. He didn't explain how he detected it
though.
 
K

kantix

The problem is a memory leak. He didn't explain how he detected it
though.

How I detect it?
1. Call function.
2. View task manager IE Mem usage and it goes up highly. If i repeat
it several time IE slows down. Nothing like this with FF.

Here is my new function updated according to your notes. I didn't made
var newTable and var newDivBckgr, because I didn't managed to pass
them to fnc_ClosePopUp then :).

function fnc_PopUp(source, title, widthPOP, heightPOP){
var openX = (845/2)-(heightPOP/2);
var openY = (1259/2)-(widthPOP/2);
newDivBckgr = document.createElement('div')
document.body.appendChild(newDivBckgr)
newDivBckgr.className = 'bckgr'

tableDiv = document.createElement('div')

tableDiv.className = 'tableDiv'
tableDiv.style.top = openX + 'px'
tableDiv.style.left = openY + 'px'
tableDiv.align = 'left'
document.body.appendChild(tableDiv)
var newTable = document.createElement('table')
newTable.border = 1
newTable.className = 'table'
newTable.cellPadding = '0'
newTable.cellSpacing = '0'
tableDiv.appendChild(newTable)

var newTbody = document.createElement('tbody')
newTable.appendChild(newTbody)

var newTr = document.createElement('tr')
newTbody.appendChild(newTr)

var newTdTitle = document.createElement('td')
newTr.appendChild(newTdTitle)

var newImg = document.createElement('img')
newImg.src = "/js/img/close.png"
newTdTitle.appendChild(newImg)
newImg.style.position = 'relative'
newImg.align = 'right'
newImg.style.top = '1px'
newImg.onclick = fnc_ClosePopUp; //doesn't help even if I comment
this (though I can't close 'popup')
newTxt = document.createTextNode(title)
newTdTitle.className = 'tdTitle'
newTdTitle.appendChild(newTxt)

var newiframeTr = document.createElement('tr')
newTbody.appendChild(newiframeTr)

var newiframeTd = document.createElement('td')
newiframeTr.appendChild(newiframeTd)

var newiframe = document.createElement('iframe')
newiframe.iframeBorder = "0"
newiframe.src = source
newiframe.style.width = widthPOP + 'px'
newiframe.style.height = heightPOP + 'px'
newiframeTd.appendChild(newiframe)
newImg = null
}
 
K

kantix

How I detect it?
1. Call function.
2. View task manager IE Mem usage and it goes up highly. If i repeat
it several time IE slows down. Nothing like this with FF.

Here is my new function updated according to your notes. I didn't made
var newTable and var newDivBckgr, because I didn't managed to pass
them to fnc_ClosePopUp then :).

function fnc_PopUp(source, title, widthPOP, heightPOP){
var openX = (845/2)-(heightPOP/2);
var openY = (1259/2)-(widthPOP/2);
newDivBckgr = document.createElement('div')
document.body.appendChild(newDivBckgr)
newDivBckgr.className = 'bckgr'

tableDiv = document.createElement('div')

tableDiv.className = 'tableDiv'
tableDiv.style.top = openX + 'px'
tableDiv.style.left = openY + 'px'
tableDiv.align = 'left'
document.body.appendChild(tableDiv)
var newTable = document.createElement('table')
newTable.border = 1
newTable.className = 'table'
newTable.cellPadding = '0'
newTable.cellSpacing = '0'
tableDiv.appendChild(newTable)

var newTbody = document.createElement('tbody')
newTable.appendChild(newTbody)

var newTr = document.createElement('tr')
newTbody.appendChild(newTr)

var newTdTitle = document.createElement('td')
newTr.appendChild(newTdTitle)

var newImg = document.createElement('img')
newImg.src = "/js/img/close.png"
newTdTitle.appendChild(newImg)
newImg.style.position = 'relative'
newImg.align = 'right'
newImg.style.top = '1px'
newImg.onclick = fnc_ClosePopUp; //doesn't help even if I comment
this (though I can't close 'popup')
newTxt = document.createTextNode(title)
newTdTitle.className = 'tdTitle'
newTdTitle.appendChild(newTxt)

var newiframeTr = document.createElement('tr')
newTbody.appendChild(newiframeTr)

var newiframeTd = document.createElement('td')
newiframeTr.appendChild(newiframeTd)

var newiframe = document.createElement('iframe')
newiframe.iframeBorder = "0"
newiframe.src = source
newiframe.style.width = widthPOP + 'px'
newiframe.style.height = heightPOP + 'px'
newiframeTd.appendChild(newiframe)
newImg = null

}

Btw, changes didn't help at all:).
 
K

kantix

Btw, changes didn't help at all:).

Here is the source of my problem:

.bckgr {filter: alpha (opacity=60); opacity: .6; background-
color:#000000; height: 100%; width: 100%;padding-top: 100px; position:
absolute; left: 0px; top: 0px;}
 
D

David Mark

That is because in the original the newImg variable was global. Take
out the line that sets newImg to null and go back to your old method
of creating a closure for the onclick handler and you will definitely
leak memory.
Here is the source of my problem:

.bckgr {filter: alpha (opacity=60); opacity: .6; background-
color:#000000; height: 100%; width: 100%;padding-top: 100px; position:
absolute; left: 0px; top: 0px;}

That would have been hard to peg as you didn't post it. Of course,
other than being invalid CSS, I don't see a problem with it (certainly
nothing that would cause a memory leak.) What leads you to the
conclusion that this is the problem?
 
K

kantix

That is because in the original the newImg variable was global. Take
out the line that sets newImg to null and go back to your old method
of creating a closure for the onclick handler and you will definitely
leak memory.

Hmm I'm not sure I understand what you mean. You mean that if I make
all variables local and form a closure I avoid or don't avoid memory
leak? Cos I don't avoid it this way:

...
newImg.style.top = '1px'
newImg.onclick = function() {
fnc_ClosePopUp(newDivBckgr, tableDiv)
}
var newTxt = document.createTextNode(title)
...
That would have been hard to peg as you didn't post it. Of course,
other than being invalid CSS, I don't see a problem with it (certainly
nothing that would cause a memory leak.) What leads you to the
conclusion that this is the problem?

Well I guess I wasn't accurate. This is what eats my memory so bad. In
my original code .bckgr height was 2000%. If I decrease/remove height
my memory leak decreases a lot AND it is gone if I remove opacity...

Thanks for help.
 
D

David Mark

Hmm I'm not sure I understand what you mean. You mean that if I make
all variables local and form a closure I avoid or don't avoid memory
leak? Cos I don't avoid it this way:

...
newImg.style.top = '1px'
newImg.onclick = function() {
fnc_ClosePopUp(newDivBckgr, tableDiv)
}
var newTxt = document.createTextNode(title)
...

If newImg is declared locally and you fail to set it to null before
exiting this function, you will leak memory.
Well I guess I wasn't accurate. This is what eats my memory so bad. In
my original code .bckgr height was 2000%. If I decrease/remove height

I have no idea why that would be, but setting a height to 2000% serves
no practical purpose.
my memory leak decreases a lot AND it is gone if I remove opacity...

The opacity filter uses an ActiveX object, which uses DirectX, so
there is no telling how that might affect memory usage and garbage
collection. You might ask Microsoft.
 
K

kantix

If newImg is declared locally and you fail to set it to null before
exiting this function, you will leak memory.

OK, newImg is local and I set it to null at the end of the function.
And it doesn't help.

Could you please tell me not when I will leak memory, but when I won't
leak?
 
D

David Mark

OK, newImg is local and I set it to null at the end of the function.
And it doesn't help.

Could you please tell me not when I will leak memory, but when I won't
leak?

If you set the newImg variable to null on exiting the function, you
will not create a closure with a circular reference and therefore will
not leak the onclick event code.

I thought you found your leak and it was CSS related. (?)
 
K

kantix

If you set the newImg variable to null on exiting the function, you
will not create a closure with a circular reference and therefore will
not leak the onclick event code.

...
var newImg = document.createElement('img')
newImg.src = "/js/img/close.png"
newTdTitle.appendChild(newImg)
newImg.style.position = 'relative'
newImg.align = 'right'
newImg.style.top = '1px'

newImg.onclick = function() {
newImg = null //-------like this?
fnc_ClosePopUp(newDivBckgr, tableDiv)
}


var newTxt = document.createTextNode(title)
newTdTitle.className = 'tdTitle'
newTdTitle.appendChild(newTxt)

var newiframeTr = document.createElement('tr')
newTbody.appendChild(newiframeTr)

var newiframeTd = document.createElement('td')
newiframeTr.appendChild(newiframeTd)

var newiframe = document.createElement('iframe')
newiframe.iframeBorder = "0"
newiframe.src = source
newiframe.style.width = widthPOP + 'px'
newiframe.style.height = heightPOP + 'px'
newiframeTd.appendChild(newiframe)
newImg = null //-------or like like this?

}

function fnc_ClosePopUp(newDivBckgr, tableDiv){
document.getElementsByTagName('body')[0].removeChild(tableDiv)
document.getElementsByTagName('body')[0].removeChild(newDivBckgr)
document.body.style.overflow = 'scroll'
}


I thought you found your leak and it was CSS related. (?)

Hmm. But now I think that the problem is only with opacity. When I
remove opacity option from CSS my memory usafe goes up a bit when I
call my popup, but when I close it it goes down to normal. (If use
opacity memory usage goes up every time I call function until
refresh). So I have 3 choices now:
1. decrease my memory leak by ajusting CSS.
2. remove opacity at all :(.
3. or get some good idea from you :).
 
K

kantix

remove opacity option from CSS my memory usafe goes up a bit when I
call my popup, but when I close it it goes down to normal.
^^^^^^^^^^^^^^^^^^^^^^
Just to be accurate - I'm not sure of this.
 
D

David Mark

On Oct 17, 4:12 am, (e-mail address removed) wrote:
If you set the newImg variable to null on exiting the function, you
will not create a closure with a circular reference and therefore will
not leak the onclick event code.

...
var newImg = document.createElement('img')
newImg.src = "/js/img/close.png"
newTdTitle.appendChild(newImg)
newImg.style.position = 'relative'
newImg.align = 'right'
newImg.style.top = '1px'

newImg.onclick = function() {
newImg = null //-------like this?
No.

fnc_ClosePopUp(newDivBckgr, tableDiv)
}

var newTxt = document.createTextNode(title)
newTdTitle.className = 'tdTitle'
newTdTitle.appendChild(newTxt)

var newiframeTr = document.createElement('tr')
newTbody.appendChild(newiframeTr)

var newiframeTd = document.createElement('td')
newiframeTr.appendChild(newiframeTd)

var newiframe = document.createElement('iframe')
newiframe.iframeBorder = "0"
newiframe.src = source
newiframe.style.width = widthPOP + 'px'
newiframe.style.height = heightPOP + 'px'
newiframeTd.appendChild(newiframe)
newImg = null //-------or like like this?
Yes.


}

function fnc_ClosePopUp(newDivBckgr, tableDiv){
document.getElementsByTagName('body')[0].removeChild(tableDiv)
document.getElementsByTagName('body')[0].removeChild(newDivBckgr)
document.body.style.overflow = 'scroll'

}
I thought you found your leak and it was CSS related. (?)

Hmm. But now I think that the problem is only with opacity. When I
remove opacity option from CSS my memory usafe goes up a bit when I
call my popup, but when I close it it goes down to normal. (If use
opacity memory usage goes up every time I call function until
refresh). So I have 3 choices now:

If the memory is restored when you refresh, then it isn't a memory
leak. Leaked memory is not restored until you close the browser.
1. decrease my memory leak by ajusting CSS.

I don't see how CSS has anything to do with it.
2. remove opacity at all :(.

You shouldn't define the non-standard opacity rules in style sheets
anyway. Assign the rules in script instead. Regardless, I've never
heard of memory leaks caused by opacity styles.
 
K

kantix

newiframe.style.height = heightPOP + 'px'

This doesn't help.

If the memory is restored when you refresh, then it isn't a memory
leak. Leaked memory is not restored until you close the browser.


http://www.bazon.net/mishoo/articles.epl?art_id=824 - here is written
about memory leaks and that memory is restored when you refresh
browser.
You shouldn't define the non-standard opacity rules in style sheets
anyway. Assign the rules in script instead. Regardless, I've never
heard of memory leaks caused by opacity styles.

Btw, why is this not working?

newDivBckgr.style.filter = 'alpha(opacity=60)'
 
D

David Mark

This doesn't help.

Then your leak lies elsewhere. But it will certainly hurt if you
leave it out (you will have another leak.)
http://www.bazon.net/mishoo/articles.epl?art_id=824- here is written
about memory leaks and that memory is restored when you refresh
browser.

You must have misread it. The leaks described are not restored on
refresh, but when the browser is closed. If they were restored on
refresh, they wouldn't be leaks.
Btw, why is this not working?

newDivBckgr.style.filter = 'alpha(opacity=60)'

I don't know. Did you add the filter before or after assigning the
div's className and appending it to the document?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,150
Messages
2,570,853
Members
47,394
Latest member
Olekdev

Latest Threads

Top