Forum Moderators: open

Message Too Old, No Replies

Internet Explorer, JavaScript and Excessive Memory Usage

IE, JScript, Mem Usage

         

Joshie76returns

5:59 pm on Jan 20, 2004 (gmt 0)

10+ Year Member



Well hello again everybody!
Long time no see.

(I've been away working on thick-client projects for a while - I seem unable to revive my old handle)

I'll get straight to the point. I'm having some problems getting to grips with a new JavaScript OO implementation of a spreadsheet for the web.

The thing works like a dream. However, with succesive page refreshes and re-creation of the JS objects, the Mem Usage of IEXPLORE.EXE just keeps creeping up (I've had it exceed 300MB Ram!)

As you can imagine this starts to slow things up a little!

It appears that IE is not doing it's job and cleaning up the lost (unloaded) pages. I've tried manually dereferencing all the objects (oObject = null;).

Does anybody have any bright ideas on how I can prevent or fix this?

Thanks in advance

Josh

hakre

7:15 pm on Jan 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hi josh,

ie doesn't even check how much memory js is consuming. you can make an unstopable script, that concats a string with itself getting bigger and bigger until windows crashes with a bluescreen. this was on win2k and winXP.

but if you need to use that kind of script everyone is aware of, feel free to upgrade your memory ;) - just place the systemrequirements on the website ;)

ok, hehe, try set XX = nothing, that will do the job (i hope for you),

-hakre

Joshie76returns

10:42 am on Jan 22, 2004 (gmt 0)

10+ Year Member



Set xx = nothing
looks very VB like to me...

I have created a *destroy* script which runs through every object and deletes all it's properties and methods like so...

function myNewObject()
{
this.property1 = "something";
this.property2 = "something else";
}

myNewObject.prototype.someMethod = someFunctionOrOther;
myNewObject.prototype.destroy = destroy;

function destroy()
{
this.property1 = null;
this.property2 = null;

delete this.property1;
delete this.property2;
delete this.someMethod;
delete this.destroy;
}

This now seems to be working a treat and has significantly reduced the memory *leak*. I can't believe that you have to do this - what an absolute mess the JS scripting host must be in IE.