Function autorelease

  • Create an autorelease pool, execute the given computation in it and release the pool. All objects that were created during the computation that derive from AutoReleasable (e.g. instances ImageRef) and were not retained with a call to .retain() are released when the autorelease pool is released at the end of the computation. If autorelease pools are nested, then the objects are released when the outermost autorelease pool is released.

    AutoReleasable objects require an autorelease pool when created unless the requirement has been disabled with a call to setAutoreleaseRequired.

    Type Parameters

    • TReturn

    Parameters

    • computation: (() => Promise<TReturn>)

      The computation to execute.

    Returns Promise<TReturn>

    A promise that resolves to the result of the computation.