Forum Moderators: open

Message Too Old, No Replies

can someone plese help to answer these questions?

         

garylee

5:32 pm on Jun 13, 2006 (gmt 0)

10+ Year Member



Q1: How is garbage collection handled in Javascript?

Thanks alot,
Gary

RonPK

11:31 am on Jun 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It is done automatically.

The JavaScript interpreter is able to detect when an object will never again be used by the program. When it determines that an object is unreachable (i.e., there is no longer any way to refer to it using the variables in the program), it knows that the object is no longer needed and its memory can be reclaimed.

Source: David Flanagan, JavaScript: The Definitive Guide, 3rd edition, p. 59.