[Javascript] JavaScript garbage collector
Josiah Gordon
jgordon at directfile.com
Thu Jun 6 10:53:41 CDT 2002
Dan,
In Javascript, garbage collection is done automatically by the Javascript
environment in the client's browser. IE 3+ and NN4+ use the mark and sweep
algorithm in which the garbage collector periodically traverses the list of
all variables in the Javascript environment, marking variables that are
referred to by other variables. For objects and arrays, properties are
recursively marked.
After stepping through the whole list (probably a binary tree of some sort)
the algorithm knows that any unmarked variable is garbage. The sweep phase
is asynchronous and shouldn't have a noticeable impact when running (at
least that's the idea).
This is a paraphrasing from David Flanagan's O'Reilly Javascript book pages
192-197, especially 193.
HTH,
Josiah Gordon
-----Original Message-----
From: javascript-admin at LaTech.edu [mailto:javascript-admin at LaTech.edu]On
Behalf Of Dan Costea
Sent: Thursday, June 06, 2002 4:37 PM
To: javascript at LaTech.edu
Subject: [Javascript] JavaScript garbage collector
Can anybody tell me if there is a way to call the browser's garbage
collector from js (at least for IE) ???
Or, can you give me a link with documentation about how IE is working with
the memory and with th garbage collector?
Thank you,
Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20020606/e994c65c/attachment.htm>
More information about the Javascript
mailing list