Skip to content

v.destroy()

Use v.destroy() when you are done with nodes and want to release Volten-owned internal resources.

const node = v.pass(kernel, { data });
v.run(node);
v.destroy(node);

If the node depends on earlier work through handles, those dependencies are included too.

v.destroy() destroys resources created by Volten for nodes, such as hidden bounds-guard uniforms and debug buffers.

It does not destroy user-created resources:

  • Buffer
  • RawBuffer
  • Uniform
v.destroy(node);
// User buffers are still yours.
data.set([1, 2, 3, 4]);
v.destroy([A, B]);

Shared dependencies are visited once.

Calling v.destroy(node) is safe more than once.

You can also run the node again later. Volten recreates the internal resources it needs.

v.destroy(node);
v.run(node);