Amrit Ranjan wrote:
> delete key word is not applicable for those variable which are
> declared with var keyword. Please refer following site.
> http://developer.mozilla.org/en/docs...elete_Operator
`delete' is applicable in that case, but it does not change anything.
> If you really want to clear the memory use Array.splice method
> example
> X.splice(0, X.length);
> this method will clear the memory of the X,
Certainly it won't. The memory assigned to the values of the elements of
the array *may* be freed but it could also be that the corresponding objects
are merely marked for garbage collection.
> but X is still an array.
Which is why the memory required for storing that object is only reduced, if
that.
> Now make X = null.
That assignedment could have been performed in the first place and it would
have made little difference. That is, with that assignment X is marked as
being ready for garbage collection, and the objects its properties refer to
as well, provided there are no further references to either object.
> Do not assign X = [] again. It will just change the reference
> pointer.
There is no significant difference in assigning [] and calling
X.splice(0, X.length). See ECMAScript Ed. 3, section 15.4.4.12.
> any way as because var is used and the execution sample is in
> function, it will clear the memory when scope goes out.
It *may* clear the memory then.
I really wonder where your "wisdom" comes from.
PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>