node-addon-layer
C API For writing Node modules
|
shim_val_t is a thin opaque pointer to a V8 heap object. Memory management of shim_val_t's is by and large explicit. Aside from the noted exceptions below, all returned shim_val_t's should be passed to shim_value_release(). This will only cleanup any resources the addon layer has allocated. Releasing a shim_val_t does not indicate to V8 that it may now garbage collect the underlying object.
In V8 there are two basic kinds of values:
shim_val_t's will be a Local unless it was returned by shim_persistent_new(), in which case you'll be returned a shim_val_t that wraps a Persistent.
Wrapped Persistents should only be released by calling shim_persistent_dispose(). Do not use shim_value_release().
If you want to be notified when the GC is about to collect a value, see shim_obj_make_weak().
shim_val_t's retrieved from:
or passed to:
do not need to be shim_value_release()'d, the addon layer will handle the releasing when the boundary function has finished executing.
shim_null() and shim_undefined() are singletons, they are ignored when passed to shim_value_release(), it's neither necessary or harmful to do so.