An object which has been rooted will not be collected by the GC even if it has no other references. Rooted objects can also be used to safely pass managed objects into unmanaged code.

Static methods

staticcreate(obj:Dynamic):RootHandle

Root the provided object and return a handle representing it.

staticfromVoidPointer(ptr:Pointer<Void>):RootHandle

Reinterpret the provided void* as a rooted object. If ptr is not a rooted object the behaviour is undefined.

Methods

close():Void

Unroot the object represented by this handle. If there are no other references to the object it will be eligible for collection by the GC.

getObject():Dynamic

Return the object represented by this handle.

toVoidPointer():Pointer<Void>

Returns the rooted object reinterpreted as a void*.