[+v8-users; chromium-dev to BCC]

There's no need to "flag" objects for GC at all. In fact, there isn't even
a way to do that, because there's no such flag that the GC would know
about. It simply collects objects that are unreachable. More specifically:

On Thu, May 5, 2016 at 11:45 PM, Greg Lindquist <biscuitclea...@gmail.com>
wrote:

> A simple snippet of what I'm doing is this:
>
> // Creation/allocation
> var object = {};
> object.property = [];  // Prefer creating properties in the constructor
> function.
>
> //Destroy method
> object.property = null;  // This is unnecessary.
> delete object.property;  // This is unnecessary. Also, "delete" is
> harmful in general, avoid it.
> object = null;  // This is enough. If |object| is local to a function,
> you don't even need this.
>

In other words, the following is all you need:

function whatever() {
  var object = new MyObj();

  /* do stuff with object */

  // no "object = null" dance necessary here, "object" is about to go out
of scope anyway.
}

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to