Freeing JavaScript object

Posted by pion on Stack Overflow See other posts from Stack Overflow or by pion
Published on 2010-12-23T23:20:33Z Indexed on 2010/12/23 23:54 UTC
Read the original article Hit count: 234

Filed under:

I am looking at the example from http://www.javascriptkit.com/javatutors/oopjs.shtml

var person = new Object()
person.name = "Tim Scarfe"
person.height = "6Ft"

But there is no mention how to "free" it in order to avoid memory leak.

Will the following code free it?

person = null;
  1. How do you free a JavaScript Object using "new Object()?
  2. How do you free a JavaScript Array allocated using "new Array(10)"?
  3. How do you free a JavaScript JSON allocated using "var json = {"width": 480, "height": 640}"?

Thanks in advance for your help.

© Stack Overflow or respective owner

Related posts about JavaScript