Javascript equivalent for VBScript

P

polychrom

What is Javascript equivalent for this VBScript line:

Set WshShell = Nothing

Thanks.
 
M

Martin Honnen

What is Javascript equivalent for this VBScript line:

Set WshShell = Nothing

The following is similar
WshShell = null;
but while with VBScript the Set VarName = Nothing releases system and
memory resources if not other variable refers to it with JavaScript you
have garbage collection which runs periodically or on demand to free
resources.
 
P

polychrom

Martin Honnen пиÑал(а):
(e-mail address removed) wrote:

What is Javascript equivalent for this VBScript line:

Set WshShell = Nothing
-----------------------
The following is similar
WshShell = null;
but while with VBScript the Set VarName = Nothing releases system and
memory resources if not other variable refers to it with JavaScript you
have garbage collection which runs periodically or on demand to free
resources.

Martin Honnen
http://JavaScript.FAQTs.com/

-----------------------------

I mean the same purpose, release system and free memory resources after
code finished:

var WSHShell;
WSHShell = new ActiveXObject("WScript.Shell");
.... ....

WshShell = null;

is this correct?
 
M

Matt Kruse

I mean the same purpose, release system and free memory resources
after code finished:
var WSHShell;
WSHShell = new ActiveXObject("WScript.Shell");
WshShell = null;
is this correct?

It's correct, yes. But it doesn't do exactly what you're asking.

Read up on Garbage Collection as a programming concept. The whole point is,
you don't get to control when memory and resources are freed. The language
implementation does that for you. You don't need to care. The above code
makes the object _available_ for cleanup, which is all you need to do.

IE has proprietary methods to explicitly call the garbage collector, but you
still can't guarantee that your resources will be freed when you want them
to be.
 

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
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top