Share via


SurfaceTexture.Release Method

Definition

release() frees all the buffers and puts the SurfaceTexture into the 'abandoned' state.

[Android.Runtime.Register("release", "()V", "GetReleaseHandler")]
public virtual void Release ();
[<Android.Runtime.Register("release", "()V", "GetReleaseHandler")>]
abstract member Release : unit -> unit
override this.Release : unit -> unit
Attributes

Remarks

release() frees all the buffers and puts the SurfaceTexture into the 'abandoned' state. Once put in this state the SurfaceTexture can never leave it. When in the 'abandoned' state, all methods of the IGraphicBufferProducer interface will fail with the NO_INIT error.

Note that while calling this method causes all the buffers to be freed from the perspective of the the SurfaceTexture, if there are additional references on the buffers (e.g. if a buffer is referenced by a client or by OpenGL ES as a texture) then those buffer will remain allocated.

Always call this method when you are done with SurfaceTexture. Failing to do so may delay resource deallocation for a significant amount of time.

Java documentation for android.graphics.SurfaceTexture.release().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to