MozillaZine


Memory Leakage on my javascript intensive application in FF

Discuss how to use and promote Web standards with the Mozilla Gecko engine.
wing.t.lee
 
Posts: 1
Joined: February 12th, 2015, 6:43 pm

Post Posted February 12th, 2015, 7:09 pm

Hi,

I'm using Firefox ESR 24.3.0 as a standard browser for my GWT (SmartGWT) application.

During my testing, I find application have slow response after repeat a feature for 15 minutes. And per checking by Firebug DOM tab, I find particular global variable start with isc_XXXXXX (which is SmartGWT objects) accumulate. But per checking that all accumulated isc_ object is null but still accumulated in Firefox's memory. So my question is
- Does null javascript objects mean the object is already ready for GC in FireFox?
- How can I clean up the null javascript objects in Firefox?
- If unfortunately the null javascript objects is not ready for GC due to some association with other non-null object, How can I find that association and the objects from Firebug (or other debug tools in FF)?

Thx in advanced

Dom1953
 
Posts: 52
Joined: July 24th, 2014, 6:02 am
Location: Australia

Post Posted February 13th, 2015, 3:10 pm

null is a valid object variable value, equivalent to zero for numbers or the empty set in mathematics. Its use does not ready a variable for the GC. The way to remove a a global reference is to delete it using the delete keyword. Note you cannot remove a global value that was declared using a var statement (Ref).

Hence
Code: Select all
window.isc_123456 = something;
delete window.isc_123456; // when done
should work. Better still would be to create these temporary values as properties of a global object that remains in place, as for example
Code: Select all
var isc = {}; // declare object globally
isc.xxxxxx = something; // when creating value
delete isc.xxxxxx; // when done


if you have set a property of some other object to one of these isc_XXXXXX values, deleting the isc_XXXXXX global property will NOT also delete the value held as a property of "some other object". Such a property would also need to be explicitly deleted.

Return to Web Development / Standards Evangelism


Who is online

Users browsing this forum: No registered users and 1 guest