JSGarbageCollect(_:)
Performs a JavaScript garbage collection.
Declaration
func JSGarbageCollect(_ ctx: JSContextRef!)Parameters
- ctx:
The execution context to use.
Discussion
The system doesn’t collect JavaScript values that are on the machine stack, are in a register, are receiving protection from JSValueProtect(_:_:), are the global object of an execution context, or are reachable from any such value.
During JavaScript execution, you don’t have to call this function because the JavaScript engine collects garbage as necessary. The system automatically destroys JavaScript values within a context group when the last reference to the context group releases.